title = get_string('clickedu', 'block_clickedu');
$this->version = 2011052300;
}
function applicable_formats() {
return array('site-index' => true );
}
function instance_allow_config() {
return false;
}
function instance_allow_multiple() {
return false;
}
function _self_test() {return true; }
function get_content() {
if ($this->content !== NULL) {
return $this->content;
}
if (isguestuser() or !isloggedin()) {
$this->content = '';
return '';
}
global $USER, $CFG;
if(isset($_GET['doClickedu'])) {
$_SESSION['clickedu_login'] = true;
}
$this->content = new stdClass;
$this->content->text = '';
$this->content->footer = '';
$this->content->items = array();
$this->content->icons = array();
$lnk_block = $CFG->wwwroot.'/blocks/clickedu/';
$oauth_tokens = getAccessTokens();
$url_config19 = new moodle_url( $lnk_block.'config19.php', array('blockid' => $this->instance->id ) );
if( isadmin() )
{
if( !$this->config->username || !$this->config->password || !$this->config->url ){
// Si és >= moodle2.0, mostrem que falta configurar. Si no, mostrem el vincle de configuració de la 1.9
/*if( ES_MOODLE_20 )
$this->content->items[] = get_string('Falta Configurar', 'block_clickedu' );
else
$this->content->items[] = ''.get_string('falta_configurar', 'block_clickedu' ).'';
*/
$this->content->items[] = get_string('falta_configurar', 'block_clickedu' );
}
else
{
if($USER->id > 0) {
if ( isadmin() ) {
$syncUserUrl = new moodle_url($lnk_block.'clickedu.php', array('action' => 'syncUsers', 'blockid' => $this->instance->id ) );
$syncCourseUrl=new moodle_url($lnk_block.'clickedu.php', array('action' => 'syncCourses', 'blockid' => $this->instance->id) );
$this->content->items[] = ''.get_string('users_clickedu_moodle', 'block_clickedu').'';
$this->content->items[] = '
'.get_string('lnk_sync_allusers', 'block_clickedu').'';
$this->content->items[] = ''.get_string('lnk_sync_courses', 'block_clickedu').'';
}
}
else {
$this->content->text = '';
}
}
$url = new moodle_url( $lnk_block.'oauth_clickedu.php', array('blockid' => $this->instance->id ) );
$this->content->items[] = ''.utf8_encode(get_string('auth_clickedu', 'block_clickedu' )).'';
if( ES_MOODLE_20 )
{
$this->content->items[] = ''.get_string('configurar', 'block_clickedu' ).'';
}else{
$this->content->items[] = ''.get_string('configurar', 'block_clickedu' ).'';
}
}
return $this->content;
}
}