当前位置: 首页>>代码示例>>PHP>>正文


PHP Console::error方法代码示例

本文整理汇总了PHP中Console::error方法的典型用法代码示例。如果您正苦于以下问题:PHP Console::error方法的具体用法?PHP Console::error怎么用?PHP Console::error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Console的用法示例。


在下文中一共展示了Console::error方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: user_add_to_course

/**
 * Subscribe a specific user to a specific course.  If this course is a session
 * course, the user will also be subscribed to the source course.
 * 
 * Helper for Claro_CourseUserRegistration
 *
 * @param int $userId user ID from the course_user table
 * @param string $courseCode course code from the cours table
 * @param boolean $admin
 * @param boolean $tutor
 * @param int $class_id
 * @return boolean TRUE  if it succeeds, FALSE otherwise
 */
function user_add_to_course($userId, $courseCode, $admin = false, $tutor = false, $class_id = null)
{
    $courseObj = new Claro_Course($courseCode);
    $courseObj->load();
    $courseRegistration = new Claro_CourseUserRegistration(AuthProfileManager::getUserAuthProfile($userId), $courseObj, null, null);
    if ($admin) {
        $courseRegistration->setCourseAdmin();
    }
    if ($tutor) {
        $courseRegistration->setCourseTutor();
    }
    if ($class_id) {
        $claroClass = new Claro_Class();
        $claroClass->load($class_id);
        $courseRegistration->setClass($claroClass);
    }
    $courseRegistration->ignoreRegistrationKeyCheck();
    if ($courseRegistration->addUser()) {
        return true;
    } else {
        // @todo should throw an exception here
        Console::error("Cannot register user {$userId} in course {$courseCode} [" . $courseRegistration->getStatus() . ":" . $courseRegistration->getErrorMessage() . "]");
        return false;
    }
}
开发者ID:rhertzog,项目名称:lcs,代码行数:38,代码来源:course_user.lib.php

示例2: mergeCourseUsers

 public function mergeCourseUsers($uidToRemove, $uidToKeep, $courseId)
 {
     $moduleCourseTbl = get_module_course_tbl(array('wrk_submission'), $courseId);
     $sql = "UPDATE `{$moduleCourseTbl['wrk_submission']}`\n                SET   user_id = " . (int) $uidToKeep . "\n                WHERE user_id = " . (int) $uidToRemove;
     if (!claro_sql_query($sql)) {
         Console::error("Cannot update wrk_submission from -{$uidToRemove} to +{$uidToKeep} in {$courseId}");
         return false;
     } else {
         return true;
     }
 }
开发者ID:rhertzog,项目名称:lcs,代码行数:11,代码来源:mergeuser.cnr.php

示例3: mergeCourseUsers

 public function mergeCourseUsers($uidToRemove, $uidToKeep, $courseId)
 {
     $tblList[] = 'lp_module';
     $tblList[] = 'lp_learnPath';
     $tblList[] = 'lp_rel_learnPath_module';
     $tblList[] = 'lp_asset';
     $tblList[] = 'lp_user_module_progress';
     $moduleCourseTbl = get_module_course_tbl($tblList, $courseId);
     // Update lp_user_module_progress
     $sql = "UPDATE `{$moduleCourseTbl['lp_user_module_progress']}`\n                SET   user_id = " . (int) $uidToKeep . "\n                WHERE user_id = " . (int) $uidToRemove;
     if (!claro_sql_query($sql)) {
         Console::error("Cannot update lp_user_module_progress from -{$uidToRemove} to +{$uidToKeep} in {$courseId}");
         return false;
     }
     return true;
 }
开发者ID:rhertzog,项目名称:lcs,代码行数:16,代码来源:mergeuser.cnr.php

示例4: getConfigFile

 public static function getConfigFile()
 {
     $deprecated_config_file = self::root() . self::DEPRECATED_CONFIG_FILE;
     $credentials_cli_path = self::getCredentialsPath() . 'cli.json';
     if (file_exists($deprecated_config_file)) {
         Console::error("You are using deprecated `.hook-config` file." . PHP_EOL . "Do you want to upgrade it? (y/n)");
         $answer = Console::readline();
         if ($answer == "y") {
             self::createCredentialsDirectory();
             rename($deprecated_config_file, $credentials_cli_path);
         } else {
             static::$temp_config = json_decode(file_get_contents($deprecated_config_file), true);
             return $deprecated_config_file;
         }
     }
     return $credentials_cli_path;
 }
开发者ID:endel,项目名称:hook-cli,代码行数:17,代码来源:Project.php

示例5: mergeCourseUsers

 public function mergeCourseUsers($uidToRemove, $uidToKeep, $courseId)
 {
     $moduleCourseTbl = get_module_course_tbl(array('wiki_pages', 'wiki_pages_content'), $courseId);
     // Update wiki_pages
     $sql = "UPDATE `{$moduleCourseTbl['wiki_pages']}`\n                SET   owner_id = " . (int) $uidToKeep . "\n                WHERE owner_id = " . (int) $uidToRemove;
     if (!claro_sql_query($sql)) {
         Console::error("Cannot update wiki_pages from -{$uidToRemove} to +{$uidToKeep} in {$courseId}");
         return false;
     }
     // Update wiki_pages_content
     $sql = "UPDATE `{$moduleCourseTbl['wiki_pages_content']}`\n                SET   editor_id = " . (int) $uidToKeep . "\n                WHERE editor_id = " . (int) $uidToRemove;
     if (!claro_sql_query($sql)) {
         Console::error("Cannot update wiki_pages_content from -{$uidToRemove} to +{$uidToKeep} in {$courseId}");
         return false;
     }
     return true;
 }
开发者ID:rhertzog,项目名称:lcs,代码行数:17,代码来源:mergeuser.cnr.php

示例6: authenticate

 public function authenticate()
 {
     $auth = new Claro_Ldap($this->extAuthOptionList['url'], $this->extAuthOptionList['port'], $this->extAuthOptionList['basedn']);
     try {
         $auth->connect();
         // no anonymous bind
         // user can search
         if ($this->userSelfBindAuth == 'true') {
             $searchdn = "{$this->userAttr}={$this->username}," . $this->extAuthOptionList['basedn'];
             $searchpw = $this->password;
             $auth->bind($searchdn, $searchpw);
         } elseif ($this->useBindDn) {
             $searchdn = $this->extAuthOptionList['binddn'];
             $searchpw = $this->extAuthOptionList['bindpw'];
             $auth->bind($searchdn, $searchpw);
         }
         // search user
         $user = $auth->getUser($this->username, $this->userFilter, $this->userAttr);
         if ($user) {
             if ($this->userSelfBindAuth == 'true') {
                 $binddn = "{$this->userAttr}={$this->username}," . $this->extAuthOptionList['basedn'];
             } else {
                 $binddn = $user->getDn();
             }
             if ($auth->authenticate($binddn, $this->password)) {
                 $this->user = $user;
                 return true;
             } else {
                 return false;
             }
         }
     } catch (Exception $e) {
         $this->setFailureMessage($e->getMessage());
         if (claro_debug_mode()) {
             Console::error($e->__toString());
         } else {
             Console::error($e->getMessage());
         }
         return false;
     }
 }
开发者ID:rhertzog,项目名称:lcs,代码行数:41,代码来源:ldapauthdriver.lib.php

示例7: createUser

 /**
  * Create the admin superuser.
  *
  * @return void
  */
 protected function createUser($options = array())
 {
     try {
         if (!is_null($options) && in_array('first', $options) && in_array('last', $options) && in_array('email', $options) && in_array('password', $options)) {
             User::create(['first_name' => $options['first'], 'last_name' => $options['last'], 'email' => $options['email'], 'password' => $options['password'], 'is_superuser' => true, 'key' => str_random(32)]);
         } else {
             $this->console->info('=====LETS CREATE AN ADMIN SUPERUSER=====');
             $firstName = $this->console->ask('What is the admin\'s first name?');
             $lastName = $this->console->ask('What is the admin\'s last name?');
             $email = $this->console->ask('What is the admin\'s email address?');
             $password = $this->console->secret('Choose a password, and make it strong.');
             User::create(['first_name' => $firstName, 'last_name' => $lastName, 'email' => $email, 'password' => $password, 'is_superuser' => true, 'key' => str_random(21)]);
             $this->console->info('=====ADMIN SUPERUSER CREATED=====');
             $this->console->info('Nice! You can now login to your application with the superuser email and password.');
         }
     } catch (Exception $e) {
         $this->console->error('Whoops! Something went wrong trying to create your user.');
         $this->console->error('=====EXCEPTION START=====');
         $this->console->error($e);
         $this->console->error('=====EXCEPTION END=====');
     }
 }
开发者ID:cloud5ideas,项目名称:appkit,代码行数:27,代码来源:InstallHandler.php

示例8: mergeCourseUsers

 public function mergeCourseUsers($uidToRemove, $uidToKeep, $courseId)
 {
     $error = false;
     $moduleCourseTbl = get_module_course_tbl(array('bb_posts', 'bb_topics', 'bb_priv_msgs', 'bb_rel_forum_userstonotify', 'bb_rel_topic_userstonotify'), $courseId);
     $userToKeepProp = user_get_properties($uidToKeep);
     $sql = "UPDATE `{$moduleCourseTbl['bb_posts']}`\n                SET     poster_id = " . (int) $uidToKeep . ",\n                        nom = '" . claro_sql_escape($userToKeepProp['lastname']) . "',\n                        prenom = '" . claro_sql_escape($userToKeepProp['firstname']) . "'\n                WHERE poster_id = " . (int) $uidToRemove;
     if (!claro_sql_query($sql)) {
         Console::error("Cannot update bb_posts from -{$uidToRemove} to +{$uidToKeep} in {$courseId}");
         $error = true;
         return !$error;
     }
     // Update topic poster, lastname & firstname
     $sql = "UPDATE `{$moduleCourseTbl['bb_topics']}`\n                SET topic_poster = " . (int) $uidToKeep . ",\n                nom = '" . claro_sql_escape($userToKeepProp['lastname']) . "',\n                prenom = '" . claro_sql_escape($userToKeepProp['firstname']) . "'\n                WHERE topic_poster = " . (int) $uidToRemove;
     if (!claro_sql_query($sql)) {
         // echo mysql_error();
         Console::error("Cannot update bb_topics from -{$uidToRemove} to +{$uidToKeep} in {$courseId}");
         $error = true;
         return !$error;
     }
     // Update private messages (from)
     $sql = "UPDATE `{$moduleCourseTbl['bb_priv_msgs']}`\n                SET from_userid = " . (int) $uidToKeep . "\n                WHERE from_userid = " . (int) $uidToRemove;
     if (!claro_sql_query($sql)) {
         Console::error("Cannot update bb_priv_msgs:recipient from -{$uidToRemove} to +{$uidToKeep} in {$courseId}");
         $error = true;
         return !$error;
     }
     // Update private messages (to)
     $sql = "UPDATE `{$moduleCourseTbl['bb_priv_msgs']}`\n                SET to_userid = " . (int) $uidToKeep . "\n                WHERE to_userid = " . (int) $uidToRemove;
     if (!claro_sql_query($sql)) {
         Console::error("Cannot update bb_priv_msgs:sender from -{$uidToRemove} to +{$uidToKeep} in {$courseId}");
         $error = true;
         return !$error;
     }
     // Update topic notification
     $sql = "SELECT `topic_id`\n                FROM `{$moduleCourseTbl['bb_rel_topic_userstonotify']}`\n                WHERE `user_id` = " . (int) $uidToRemove;
     $topicIds = claro_sql_query_fetch_all($sql);
     if (!empty($topicIds)) {
         foreach ($topicIds as $_topicId) {
             $topicId = $_topicId['topic_id'];
             $sql = "SELECT `notify_id`\n                        FROM `{$moduleCourseTbl['bb_rel_topic_userstonotify']}`\n                        WHERE `user_id` = " . (int) $uidToRemove . " AND `topic_id` = " . (int) $topicId . "\n                        LIMIT 1";
             $notify = claro_sql_query_get_single_row($sql);
             if (!empty($notify)) {
                 // Update notification for userToRemove to userToKeep
                 $sql = "UPDATE `{$moduleCourseTbl['bb_rel_topic_userstonotify']}`\n                            SET user_id = " . (int) $uidToKeep . "\n                            WHERE notify_id = " . (int) $notify['notify_id'];
                 if (!claro_sql_query($sql)) {
                     Console::error("Cannot update bb_rel_topic_userstonotify from -{$uidToRemove} to +{$uidToKeep} in {$courseId}");
                     $error = true;
                 }
             }
             // Delete the notification for userToRemove
             $sql = "DELETE FROM `{$moduleCourseTbl['bb_rel_topic_userstonotify']}` WHERE `user_id` = " . (int) $uidToRemove;
             if (!claro_sql_query($sql)) {
                 Console::error("Cannot delete bb_rel_topic_userstonotify from -{$uidToRemove} to +{$uidToKeep} in {$courseId}");
                 $error = true;
             }
         }
     }
     // Update forum notification
     $sql = "SELECT `forum_id`\n                FROM `{$moduleCourseTbl['bb_rel_forum_userstonotify']}`\n                WHERE `user_id` = " . (int) $uidToRemove;
     $forumIds = claro_sql_query_fetch_all($sql);
     if (!empty($forumIds)) {
         foreach ($forumIds as $_forumId) {
             $forumId = $_forumId['forum_id'];
             $sql = "SELECT `notify_id`\n                        FROM `{$moduleCourseTbl['bb_rel_forum_userstonotify']}`\n                        WHERE `user_id` = " . (int) $uidToRemove . " AND `forum_id` = " . (int) $forumId . "\n                        LIMIT 1";
             $notify = claro_sql_query_get_single_row($sql);
             if (!empty($notify)) {
                 // Update notification for userToRemove to userToKeep
                 $sql = "UPDATE `{$moduleCourseTbl['bb_rel_forum_userstonotify']}`\n                            SET user_id = " . (int) $uidToKeep . "\n                            WHERE notify_id = " . (int) $notify['notify_id'];
                 if (!claro_sql_query($sql)) {
                     Console::error("Cannot update bb_rel_forum_userstonotify from -{$uidToRemove} to +{$uidToKeep} in {$courseId}");
                     $error = true;
                 }
             }
             // Delete the notification for userToRemove
             $sql = "DELETE FROM `{$moduleCourseTbl['bb_rel_form_userstonotify']}` WHERE `user_id` = " . (int) $uidToRemove;
             if (!claro_sql_query($sql)) {
                 Console::error("Cannot delete bb_rel_forum_userstonotify from -{$uidToRemove} to +{$uidToKeep} in {$courseId}");
                 $error = true;
             }
         }
     }
     return !$error;
 }
开发者ID:rhertzog,项目名称:lcs,代码行数:83,代码来源:mergeuser.cnr.php

示例9: claro_get_current_course_id

            Console::log("Class {$form_data['class_id']} enroled to course " . claro_get_current_course_id() . " by " . claro_get_current_user_id(), 'CLASS_SUBSCRIBE');
            $dialogBox->success(get_lang('Class has been enroled'));
        } else {
            Console::error("Class {$form_data['class_id']} cannot be enroled to course " . claro_get_current_course_id() . " by " . claro_get_current_user_id() . " : " . var_export($registration->getErrorLog(), true));
            $dialogBox->error(get_lang('Cannot enrol class'));
        }
        break;
        // Unenrol a class to the course
    // Unenrol a class to the course
    case 'exUnenrol':
        $registration = unregister_class_to_course($form_data['class_id'], claro_get_current_course_id());
        if (!$registration->hasError()) {
            Console::log("Class {$form_data['class_id']} removed from course " . claro_get_current_course_id() . " by " . claro_get_current_user_id(), 'CLASS_UNSUBSCRIBE');
            $dialogBox->success(get_lang('Class has been unenroled'));
        } else {
            Console::error("Class {$form_data['class_id']} cannot be removed from course " . claro_get_current_course_id() . " by " . claro_get_current_user_id() . " : " . var_export($registration->getErrorLog(), true));
            $dialogBox->error(get_lang('Cannot enrol class'));
        }
        break;
}
/*---------------------------------------------------------------------*/
/*----------------------FIND information SECTION-----------------------*/
/*---------------------------------------------------------------------*/
$classList = get_class_list_by_course(claro_get_current_course_id());
/*---------------------------------------------------------------------*/
/*----------------------DISPLAY SECTION--------------------------------*/
/*---------------------------------------------------------------------*/
// set bredcrump
$nameTools = get_lang('Enrol class');
ClaroBreadCrumbs::getInstance()->prepend(get_lang('Users'), 'user.php' . claro_url_relay_context('?'));
// javascript confirm pop up declaration for header
开发者ID:rhertzog,项目名称:lcs,代码行数:31,代码来源:class_add.php

示例10: array

        if ($userData['courseAdmin']) {
            $courseRegistration->setCourseAdmin();
        }
        if ($userData['profileId']) {
            $courseRegistration->setUserProfileIdInCourse($userData['profileId']);
        }
        if ($userData['courseTutor']) {
            $courseRegistration->setCourseTutor();
        }
        $courseRegistration->ignoreRegistrationKeyCheck();
        $courseRegistration->ignoreRegistrationKeyCheck();
        if ($courseRegistration->addUser()) {
            $courseRegSucceed = true;
        } else {
            // @todo should throw an exception here
            Console::error("Cannot register user {$userId} in course {$courseCode} [" . $courseRegistration->getStatus() . ":" . $courseRegistration->getErrorMessage() . "]");
            $courseRegSucceed = false;
        }
        Console::log("{$userId} enroled to course " . claro_get_current_course_id() . " by " . claro_get_current_user_id(), 'COURSE_SUBSCRIBE');
    } else {
        $courseRegSucceed = false;
    }
}
// end if $cmd == 'registration'
if ($cmd == 'applySearch') {
    // Search on username, official_code, ...
    $displayResultTable = true;
    if (!(empty($userData['lastname']) && empty($userData['firstname']) && empty($userData['email']) && empty($userData['username']) && empty($userData['officialCode']))) {
        $userList = user_search(array('lastname' => $userData['lastname'], 'firstname' => $userData['firstname'], 'email' => $userData['email'], 'officialCode' => $userData['officialCode'], 'username' => $userData['username']), claro_get_current_course_id(), true, false, !claro_is_platform_admin());
    } else {
        $userList = array();
开发者ID:rhertzog,项目名称:lcs,代码行数:31,代码来源:user_add.php

示例11: delete_course


//.........这里部分代码省略.........
    }
    $currentCourseId = trim($this_course['sysCode']);
    if (empty($currentCourseId)) {
        // This is bad !
        throw new Exception("Missing course id");
    }
    // Delete user registrations into this course
    $sql = 'DELETE FROM `' . $tbl_rel_course_user . '`
            WHERE code_cours="' . $currentCourseId . '"';
    claro_sql_query($sql);
    // Remove any recording in rel_cours_class
    $sql = "DELETE FROM `" . $tbl_course_class . "`\n            WHERE courseId ='" . claro_sql_escape($currentCourseId) . "'";
    claro_sql_query($sql);
    // Remove links between this course and categories
    $sql = "DELETE FROM `" . $tbl_rel_course_category . "`\n            WHERE courseId ='" . $this_course['id'] . "'";
    claro_sql_query($sql);
    // Remove links between this course and portlets
    $sql = "DELETE FROM `" . $tbl_rel_course_portlet . "`\n            WHERE courseId ='" . $this_course['id'] . "'";
    claro_sql_query($sql);
    // Delete the course inside the platform course registery
    $sql = 'DELETE FROM `' . $tbl_course . '`
            WHERE code= "' . claro_sql_escape($currentCourseId) . '"';
    claro_sql_query($sql);
    // Is it a session course ?
    if (!is_null($sourceCourseId)) {
        // Does the source course still have session courses ?
        $sql = "SELECT COUNT(cours_id) AS nbSessionCourses\n                FROM `" . $tbl_course . "`\n                WHERE sourceCourseId = " . (int) $sourceCourseId;
        $result = claro_sql_query_get_single_row($sql);
        if ($result['nbSessionCourses'] == 0) {
            $sql = "UPDATE `" . $tbl_course . "`\n                    SET isSourceCourse = 0\n                    WHERE cours_id = " . (int) $sourceCourseId;
            claro_sql_query($sql);
        }
    }
    // Delete course right
    RightCourseProfileToolRight::resetAllRightProfile($currentCourseId);
    // Delete course module tables
    // FIXME handle errors
    list($success, $log) = delete_all_modules_from_course($currentCourseId);
    // Notify the course deletion event
    $args['cid'] = $this_course['sysCode'];
    $args['tid'] = null;
    $args['rid'] = null;
    $args['gid'] = null;
    $args['uid'] = $GLOBALS['_uid'];
    $eventNotifier->notifyEvent("course_deleted", $args);
    if ($currentCourseId == $code) {
        $currentCourseDbName = trim($this_course['dbName']);
        $currentCourseDbNameGlu = trim($this_course['dbNameGlu']);
        $currentCoursePath = trim($this_course['path']);
        if (empty($currentCourseDbName)) {
            // This is bad !
            throw new Exception("Missing db name");
        }
        if (empty($currentCourseDbNameGlu)) {
            // This is bad !
            throw new Exception("Missing db name glu");
        }
        if (get_conf('singleDbEnabled')) {
            // SEARCH ALL TABLES RELATED TO THE CURRENT COURSE
            claro_sql_query("use " . get_conf('mainDbName'));
            $tbl_to_delete = claro_sql_get_course_tbl(claro_get_course_db_name_glued($currentCourseId));
            foreach ($tbl_to_delete as $tbl_name) {
                $sql = 'DROP TABLE IF EXISTS `' . $tbl_name . '`';
                claro_sql_query($sql);
            }
            // Underscores must be replaced because they are used as wildcards in LIKE sql statement
            $cleanCourseDbNameGlu = str_replace("_", "\\_", $currentCourseDbNameGlu);
            $sql = 'SHOW TABLES LIKE "' . $cleanCourseDbNameGlu . '%"';
            $result = claro_sql_query($sql);
            // DELETE ALL TABLES OF THE CURRENT COURSE
            $tblSurvivor = array();
            while (false !== ($courseTable = mysql_fetch_array($result, MYSQL_NUM))) {
                $tblSurvivor[] = $courseTable[0];
                //$tblSurvivor[$courseTable]='not deleted';
            }
            if (sizeof($tblSurvivor) > 0) {
                Claroline::getInstance()->log('DELETE_COURSE', array_merge(array('DELETED_COURSE_CODE' => $code, 'UNDELETED_TABLE_COUNTER' => sizeof($tblSurvivor)), $tblSurvivor));
            }
        } else {
            $sql = "DROP DATABASE `" . $currentCourseDbName . "`";
            claro_sql_query($sql);
        }
        // MOVE THE COURSE DIRECTORY INTO THE COURSE GARBAGE COLLECTOR
        if (!empty($currentCoursePath)) {
            if (file_exists(get_conf('coursesRepositorySys') . $currentCoursePath . '/')) {
                claro_mkdir(get_conf('garbageRepositorySys'), CLARO_FILE_PERMISSIONS, true);
                rename(get_conf('coursesRepositorySys') . $currentCoursePath . '/', get_conf('garbageRepositorySys', 'garbage') . '/' . $currentCoursePath . '_' . date('YmdHis'));
            } else {
                Console::warning("DELETE_COURSE : Course directory not found {$currentCoursePath} for course {$currentCourseId}");
            }
            Claroline::log('COURSE_DELETED', array('courseCode' => $currentCourseId, 'courseDbName' => $currentCourseDbName, 'courseDbNameGlu' => $currentCourseDbNameGlu, 'coursePath' => $currentCoursePath));
            return true;
        } else {
            Console::error("DELETE_COURSE : Try to delete a course repository with no folder name {$currentCourseId} !");
            return true;
        }
    } else {
        return false;
    }
}
开发者ID:rhertzog,项目名称:lcs,代码行数:101,代码来源:admin.lib.inc.php

示例12: isCourseUnregistrationAllowed

 protected function isCourseUnregistrationAllowed()
 {
     // Check if course available or option set to allow unregistration from unavailable course
     if (get_conf('crslist_UserCanUnregFromInactiveCourses', false)) {
         $isUserAllowedToUnenrol = true;
     } else {
         $curdate = claro_time();
         if (!in_array($this->course->status, array('enable', 'date'))) {
             $isUserAllowedToUnenrol = false;
             $this->status = self::STATUS_UNREGISTRATION_NOTAVAILABLE;
             $this->errorMessage = get_lang('This course currently does not allow to unenrol (status: %status)', array('%status' => $this->course->status));
         } elseif ($this->course->status == 'date' && !empty($this->course->publicationDate) && $this->course->publicationDate >= $curdate) {
             $isUserAllowedToUnenrol = false;
             $this->status = self::STATUS_UNREGISTRATION_NOTAVAILABLE;
             $this->errorMessage = get_lang('This course will be enabled on the %date', array('%date' => claro_date('d/m/Y', $this->course->publicationDate)));
         } elseif ($this->course->status == 'date' && !empty($this->course->expirationDate) && $this->course->expirationDate <= $curdate) {
             $isUserAllowedToUnenrol = false;
             $this->status = self::STATUS_UNREGISTRATION_NOTAVAILABLE;
             $this->errorMessage = get_lang('This course has been deactivated on the %date', array('%date' => claro_date('d/m/Y', $this->course->expirationDate)));
         } elseif ($this->course->status == 'date' && (empty($this->course->expirationDate) && empty($this->course->publicationDate))) {
             $isUserAllowedToUnenrol = false;
             $this->status = self::STATUS_SYSTEM_ERROR;
             $this->errorMessage = get_lang('This course is not available');
             Console::error("Invalid publication and expiration date for course " . $this->course->courseId);
         } else {
             $isUserAllowedToUnenrol = true;
         }
     }
     return $isUserAllowedToUnenrol;
 }
开发者ID:rhertzog,项目名称:lcs,代码行数:30,代码来源:courseregistration.lib.php

示例13: Claro_Course

 // (notice : it does not delete user from claroline main DB)
 if ('allStudent' == $req['user_id']) {
     // TODO : add a function to unenroll all users from a course
     $course = new Claro_Course(claro_get_current_course_id());
     $course->load();
     $claroCourseRegistration = new Claro_BatchCourseRegistration($course);
     $claroCourseRegistration->removeAllUsers($req['keepClasses']);
     $result = $claroCourseRegistration->getResult();
     if (!$result->hasError() || !$result->checkStatus(Claro_BatchRegistrationResult::STATUS_ERROR_DELETE_FAIL)) {
         $unregisterdUserCount = count($result->getDeletedUserList());
         if ($unregisterdUserCount) {
             Console::log("{$req['user_id']} ({$unregisterdUserCount}) removed by user " . claro_get_current_user_id(), 'COURSE_UNSUBSCRIBE');
         }
         $dialogBox->info(get_lang('%number student(s) unregistered from this course', array('%number' => $unregisterdUserCount)));
     } else {
         Console::error("Error while deleting all users from course " . claro_get_current_course_id() . " : " . var_export($result->getErrorLog(), true));
         $dialogBox->error(get_lang('An error occured') . ' : <ul><li>' . implode('</li><li>', $result->getErrorLog()) . '</li></ul>');
     }
 } elseif (0 < (int) $req['user_id']) {
     if ($forceUnenrolment) {
         $course = new Claro_Course(claro_get_current_course_id());
         $course->load();
         $userCourseRegistration = new Claro_CourseUserRegistration(AuthProfileManager::getUserAuthProfile($req['user_id']), $course);
         if (claro_is_platform_admin()) {
             $userCourseRegistration->forceUnregistrationOfManager();
         }
         if (!$userCourseRegistration->forceRemoveUser(false, array())) {
             $dialogBox->error(get_lang('The user cannot be removed from the course'));
         } else {
             Console::log("{$req['user_id']} removed [forced] by admin " . claro_get_current_user_id(), 'COURSE_UNSUBSCRIBE');
             $dialogBox->success(get_lang('The user has been successfully unregistered from course'));
开发者ID:rhertzog,项目名称:lcs,代码行数:31,代码来源:user.php

示例14: loadDriver

 protected static function loadDriver($driverConfigPath)
 {
     if (!file_exists($driverConfigPath)) {
         if (claro_debug_mode()) {
             throw new Exception("Driver configuration {$driverConfigPath} not found");
         }
         Console::error("Driver configuration {$driverConfigPath} not found");
         return;
     }
     $driverConfig = array();
     include $driverConfigPath;
     if ($driverConfig['driver']['enabled'] == true) {
         $driverClass = $driverConfig['driver']['class'];
         // search for kernel drivers
         if (class_exists($driverClass)) {
             $driver = new $driverClass();
             $driver->setDriverOptions($driverConfig);
             self::$drivers[$driverConfig['driver']['authSourceName']] = $driver;
         } else {
             // load dynamic drivers
             if (!file_exists(get_path('rootSys') . 'platform/conf/extauth/drivers')) {
                 FromKernel::uses('fileManage.lib');
                 claro_mkdir(get_path('rootSys') . 'platform/conf/extauth/drivers', CLARO_FILE_PERMISSIONS, true);
             }
             $driverPath = get_path('rootSys') . 'platform/conf/extauth/drivers/' . strtolower($driverClass) . '.drv.php';
             if (file_exists($driverPath)) {
                 require_once $driverPath;
                 if (class_exists($driverClass)) {
                     $driver = new $driverClass();
                     $driver->setDriverOptions($driverConfig);
                     self::$drivers[$driverConfig['driver']['authSourceName']] = $driver;
                 } else {
                     if (claro_debug_mode()) {
                         throw new Exception("Driver class {$driverClass} not found");
                     }
                     Console::error("Driver class {$driverClass} not found");
                 }
             } else {
                 if (claro_debug_mode()) {
                     throw new Exception("Driver class {$driverClass} not found");
                 }
                 Console::error("Driver class {$driverClass} not found");
             }
         }
     }
     if (isset($driverConfig['driver']['lostPasswordAllowed']) && $driverConfig['driver']['lostPasswordAllowed'] == true) {
         self::$driversAllowingLostPassword[$driverConfig['driver']['authSourceName']] = $driverConfig['driver']['authSourceName'];
     }
 }
开发者ID:rhertzog,项目名称:lcs,代码行数:49,代码来源:authmanager.lib.php

示例15: _updatePageFields

 /**
  * Update the fields of the page
  * @access private
  * @param string sql SQL query
  * @return boolean true on success, false on failure
  */
 private function _updatePageFields($sql)
 {
     try {
         $res = $this->con->query($sql);
         if ($res->numRows()) {
             $page = $res->fetch();
             $this->_setPageId($page['id']);
             $this->setOwnerId($page['owner_id']);
             $this->setTitle($this->stripSlashesForWiki($page['title']));
             $this->_setLastVersionId($page['last_version']);
             $this->_setCurrentVersionId($page['last_version']);
             $this->setCreationTime($page['ctime']);
             $this->setLastEditTime($page['last_mtime']);
             $this->setEditorId($page['editor_id']);
             $this->setContent($this->stripSlashesForWiki($page['content']));
             $this->currentVersionId = isset($page['current_version']) ? $page['current_version'] : $page['last_version'];
             $this->currentVersionMtime = isset($page['current_mtime']) ? $page['current_mtime'] : $page['last_mtime'];
             return $this;
         } else {
             return null;
         }
     } catch (Exception $e) {
         $this->setError(PAGE_CANNOT_BE_UPDATED_ERROR . ' : ' . $e->getMessage(), PAGE_CANNOT_BE_UPDATED_ERRNO);
         Console::error("CLWIKI : " . PAGE_CANNOT_BE_UPDATED_ERROR . ' : ' . $e->getMessage(), PAGE_CANNOT_BE_UPDATED_ERRNO);
     }
 }
开发者ID:rhertzog,项目名称:lcs,代码行数:32,代码来源:class.wikipage.php


注:本文中的Console::error方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。