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


PHP Event::addEvent方法代码示例

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


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

示例1: delete

 /**
  * @param int $id
  * @return bool|void
  */
 public function delete($id)
 {
     parent::delete($id);
     Event::addEvent(LOG_CAREER_DELETE, LOG_CAREER_ID, $id, api_get_utc_datetime(), api_get_user_id());
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:9,代码来源:career.lib.php

示例2: clean_results

 /**
  * Cleans the student's results only for the Exercise tool (Not from the LP)
  * The LP results are NOT deleted by default, otherwise put $cleanLpTests = true
  * Works with exercises in sessions
  * @param bool $cleanLpTests
  * @param string $cleanResultBeforeDate
  *
  * @return int quantity of user's exercises deleted
  */
 public function clean_results($cleanLpTests = false, $cleanResultBeforeDate = null)
 {
     $table_track_e_exercises = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
     $table_track_e_attempt = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
     $sql_where = '  AND
                     orig_lp_id = 0 AND
                     orig_lp_item_id = 0';
     // if we want to delete results from LP too
     if ($cleanLpTests) {
         $sql_where = "";
     }
     // if we want to delete attempts before date $cleanResultBeforeDate
     // $cleanResultBeforeDate must be a valid UTC-0 date yyyy-mm-dd
     if (!empty($cleanResultBeforeDate)) {
         $cleanResultBeforeDate = Database::escape_string($cleanResultBeforeDate);
         if (api_is_valid_date($cleanResultBeforeDate)) {
             $sql_where .= "  AND exe_date <= '{$cleanResultBeforeDate}' ";
         } else {
             return 0;
         }
     }
     $sql = "SELECT exe_id\n                FROM {$table_track_e_exercises}\n                WHERE\n                    c_id = " . api_get_course_int_id() . " AND\n                    exe_exo_id = " . $this->id . " AND\n                    session_id = " . api_get_session_id() . " " . $sql_where;
     $result = Database::query($sql);
     $exe_list = Database::store_result($result);
     // deleting TRACK_E_ATTEMPT table
     // check if exe in learning path or not
     $i = 0;
     if (is_array($exe_list) && count($exe_list) > 0) {
         foreach ($exe_list as $item) {
             $sql = "DELETE FROM {$table_track_e_attempt}\n                        WHERE exe_id = '" . $item['exe_id'] . "'";
             Database::query($sql);
             $i++;
         }
     }
     $session_id = api_get_session_id();
     // delete TRACK_E_EXERCISES table
     $sql = "DELETE FROM {$table_track_e_exercises}\n                WHERE c_id = " . api_get_course_int_id() . "\n                AND exe_exo_id = " . $this->id . "\n                {$sql_where}\n                AND session_id = " . $session_id . "";
     Database::query($sql);
     Event::addEvent(LOG_EXERCISE_RESULT_DELETE, LOG_EXERCISE_ID, $this->id, null, null, api_get_course_int_id(), $session_id);
     return $i;
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:50,代码来源:exercise.class.php

示例3: WSUnsuscribeCoursesFromSession

function WSUnsuscribeCoursesFromSession($params)
{
    if (!WSHelperVerifyKey($params)) {
        return return_error(WS_ERROR_SECRET_KEY);
    }
    // Initialisation
    $tbl_session_rel_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
    $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
    $tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
    $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
    $coursessessions_params = $params['coursessessions'];
    $results = array();
    $orig_course_id_value = array();
    $orig_session_id_value = array();
    foreach ($coursessessions_params as $coursesession_param) {
        $original_session_id_value = $coursesession_param['original_session_id_value'];
        $original_session_id_name = $coursesession_param['original_session_id_name'];
        $original_course_id_name = $coursesession_param['original_course_id_name'];
        $original_course_id_values = $coursesession_param['original_course_id_values'];
        $orig_session_id_value[] = $original_session_id_value;
        $id_session = SessionManager::getSessionIdFromOriginalId($original_session_id_value, $original_session_id_name);
        if (empty($id_session)) {
            $results[] = 0;
            continue;
        }
        // Get courses list from row_original_course_id_values
        $course_list = array();
        $courseIdList = [];
        foreach ($original_course_id_values as $row_original_course_list) {
            $course_code = Database::escape_string($row_original_course_list['course_code']);
            // Check whether exits $x_course_code into user_field_values table.
            $courseInfo = CourseManager::getCourseInfoFromOriginalId($row_original_course_list['course_code'], $original_course_id_name);
            if (empty($courseInfo) || isset($courseInfo) && $courseInfo['visibility'] == 0) {
                continue;
                // Course_code doesn't exist'
            }
            $course_list[] = $courseInfo['code'];
            $courseIdList[] = $courseInfo['real_id'];
        }
        if (empty($course_list)) {
            $results[] = 0;
            continue;
        }
        $orig_course_id_value[] = implode(',', $course_list);
        foreach ($courseIdList as $courseId) {
            $courseId = intval($courseId);
            Database::query("DELETE FROM {$tbl_session_rel_course}\n                            WHERE c_id ='{$courseId}' AND session_id='{$id_session}'");
            $result = Database::query("DELETE FROM {$tbl_session_rel_course_rel_user} WHERE c_id='{$courseId}' AND session_id = '{$id_session}'");
            Event::addEvent(LOG_SESSION_DELETE_COURSE, LOG_COURSE_ID, $courseId, api_get_utc_datetime(), api_get_user_id(), $courseId, $id_session);
            $return = Database::affected_rows($result);
        }
        $nbr_courses = 0;
        $sql = "SELECT nbr_courses FROM {$tbl_session} WHERE id = '{$id_session}'";
        $res_nbr_courses = Database::query($sql);
        $row_nbr_courses = Database::fetch_row($res_nbr_courses);
        if (Database::num_rows($res_nbr_courses) > 0) {
            $nbr_users = $row_nbr_courses[0] - $return;
        }
        // Update number of users in the session.
        $update_sql = "UPDATE {$tbl_session} SET nbr_courses= {$nbr_courses} WHERE id='{$id_session}' ";
        Database::query($update_sql);
        $results[] = 1;
        continue;
    }
    $count_results = count($results);
    $output = array();
    for ($i = 0; $i < $count_results; $i++) {
        $output[] = array('original_course_id_values' => $orig_course_id_value[$i], 'original_session_id_value' => $orig_session_id_value[$i], 'result' => $results[$i]);
    }
    return $output;
}
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:71,代码来源:registration.soap.php

示例4: register_course


//.........这里部分代码省略.........
     }
     if (empty($visual_code)) {
         $error_msg[] = 'courseScreenCode is missing';
         $ok_to_register_course = false;
     }
     if (empty($directory)) {
         $error_msg[] = 'courseRepository is missing';
         $ok_to_register_course = false;
     }
     if (empty($title)) {
         $error_msg[] = 'title is missing';
         $ok_to_register_course = false;
     }
     if (empty($expiration_date)) {
         $expiration_date = api_get_utc_datetime(time() + $firstExpirationDelay);
     } else {
         $expiration_date = api_get_utc_datetime($expiration_date);
     }
     if ($visibility < 0 || $visibility > 4) {
         $error_msg[] = 'visibility is invalid';
         $ok_to_register_course = false;
     }
     if (empty($disk_quota)) {
         $disk_quota = api_get_setting('document.default_document_quotum');
     }
     $time = api_get_utc_datetime();
     if (stripos($department_url, 'http://') === false && stripos($department_url, 'https://') === false) {
         $department_url = 'http://' . $department_url;
     }
     //just in case
     if ($department_url == 'http://') {
         $department_url = '';
     }
     $course_id = 0;
     if ($ok_to_register_course) {
         // Here we must add 2 fields.
         $sql = "INSERT INTO " . $TABLECOURSE . " SET\n                        code = '" . Database::escape_string($code) . "',\n                        directory = '" . Database::escape_string($directory) . "',\n                        course_language = '" . Database::escape_string($course_language) . "',\n                        title = '" . Database::escape_string($title) . "',\n                        description = '" . self::lang2db(get_lang('CourseDescription')) . "',\n                        category_code = '" . Database::escape_string($category_code) . "',\n                        visibility      = '" . $visibility . "',\n                        show_score      = '1',\n                        disk_quota      = '" . intval($disk_quota) . "',\n                        creation_date   = '{$time}',\n                        expiration_date = '" . $expiration_date . "',\n                        last_edit       = '{$time}',\n                        last_visit      = NULL,\n                        tutor_name = '" . Database::escape_string($tutor_name) . "',\n                        department_name = '" . Database::escape_string($department_name) . "',\n                        department_url = '" . Database::escape_string($department_url) . "',\n                        subscribe = '" . intval($subscribe) . "',\n                        unsubscribe = '" . intval($unsubscribe) . "',\n                        visual_code = '" . Database::escape_string($visual_code) . "'";
         Database::query($sql);
         $course_id = Database::insert_id();
         if ($course_id) {
             $sort = api_max_sort_value('0', api_get_user_id());
             // Default true
             $addTeacher = isset($params['add_user_as_teacher']) ? $params['add_user_as_teacher'] : true;
             if ($addTeacher) {
                 $i_course_sort = CourseManager::userCourseSort($user_id, $code);
                 if (!empty($user_id)) {
                     $sql = "INSERT INTO " . $TABLECOURSUSER . " SET\n                                c_id     = '" . $course_id . "',\n                                user_id         = '" . intval($user_id) . "',\n                                status          = '1',\n                                is_tutor        = '0',\n                                sort            = '" . $i_course_sort . "',\n                                user_course_cat = '0'";
                     Database::query($sql);
                 }
             }
             if (!empty($teachers)) {
                 if (!is_array($teachers)) {
                     $teachers = array($teachers);
                 }
                 foreach ($teachers as $key) {
                     //just in case
                     if ($key == $user_id) {
                         continue;
                     }
                     if (empty($key)) {
                         continue;
                     }
                     $sql = "INSERT INTO " . $TABLECOURSUSER . " SET\n                            c_id     = '" . Database::escape_string($course_id) . "',\n                            user_id         = '" . Database::escape_string($key) . "',\n                            status          = '1',\n                            is_tutor        = '0',\n                            sort            = '" . ($sort + 1) . "',\n                            user_course_cat = '0'";
                     Database::query($sql);
                 }
             }
             // Adding the course to an URL.
             if (api_is_multiple_url_enabled()) {
                 $url_id = 1;
                 if (api_get_current_access_url_id() != -1) {
                     $url_id = api_get_current_access_url_id();
                 }
                 UrlManager::add_course_to_url($course_id, $url_id);
             } else {
                 UrlManager::add_course_to_url($course_id, 1);
             }
             // Add event to the system log.
             $user_id = api_get_user_id();
             Event::addEvent(LOG_COURSE_CREATE, LOG_COURSE_CODE, $code, api_get_utc_datetime(), $user_id, $course_id);
             $send_mail_to_admin = api_get_setting('course.send_email_to_admin_when_create_course');
             // @todo Improve code to send to all current portal administrators.
             if ($send_mail_to_admin == 'true') {
                 $siteName = api_get_setting('platform.site_name');
                 $recipient_email = api_get_setting('admin.administrator_email');
                 $recipient_name = api_get_person_name(api_get_setting('admin.administrator_name'), api_get_setting('admin.administrator_surname'));
                 $iname = api_get_setting('platform.institution');
                 $subject = get_lang('NewCourseCreatedIn') . ' ' . $siteName . ' - ' . $iname;
                 $message = get_lang('Dear') . ' ' . $recipient_name . ",\n\n" . get_lang('MessageOfNewCourseToAdmin') . ' ' . $siteName . ' - ' . $iname . "\n";
                 $message .= get_lang('CourseName') . ' ' . $title . "\n";
                 $message .= get_lang('Category') . ' ' . $category_code . "\n";
                 $message .= get_lang('Tutor') . ' ' . $tutor_name . "\n";
                 $message .= get_lang('Language') . ' ' . $course_language;
                 $userInfo = api_get_user_info($user_id);
                 $additionalParameters = array('smsType' => SmsPlugin::NEW_COURSE_BEEN_CREATED, 'userId' => $user_id, 'courseName' => $title, 'creatorUsername' => $userInfo['username']);
                 api_mail_html($recipient_name, $recipient_email, $subject, $message, $siteName, $recipient_email, null, null, null, $additionalParameters);
             }
         }
     }
     return $course_id;
 }
开发者ID:feroli1000,项目名称:chamilo-lms,代码行数:101,代码来源:add_course.lib.inc.php

示例5: delete_attempt_hotspot

 /**
  * @param $exe_id
  * @param $user_id
  * @param int $courseId
  * @param $question_id
  * @param int $sessionId
  */
 public static function delete_attempt_hotspot($exe_id, $user_id, $courseId, $question_id, $sessionId = null)
 {
     $table_track_attempt = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTSPOT);
     $exe_id = intval($exe_id);
     $user_id = intval($user_id);
     $courseId = intval($courseId);
     $question_id = intval($question_id);
     if (!isset($sessionId)) {
         $sessionId = api_get_session_id();
     }
     $sql = "DELETE FROM {$table_track_attempt}\n                WHERE   hotspot_exe_id = {$exe_id} AND\n                        hotspot_user_id = {$user_id} AND\n                        c_id = {$courseId} AND\n                        hotspot_question_id = {$question_id} ";
     Database::query($sql);
     Event::addEvent(LOG_QUESTION_RESULT_DELETE, LOG_EXERCISE_ATTEMPT_QUESTION_ID, $exe_id . '-' . $question_id, null, null, $courseId, $sessionId);
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:21,代码来源:events.lib.php

示例6: unset

        <center>
            Are you sure you want to logout?<br/>
            <a onclick="load('logout', 'logout', 'none', {})">Yes</a> | <a
                onclick="load('home', 'none', 'none', {})">No</a>
        </center>
        <?php 
    } else {
        $_SESSION['user'] = $_SESSION['real'];
        unset($_SESSION['real']);
        ?>
        <script>
            window.location = 'main.php';
        </script>
        <?php 
    }
} else {
    if ($action == 'logout') {
        if (isset($_SESSION['user'])) {
            Event::addEvent($_SESSION['user']->getName() . ' has logged out.', $_SESSION['user'], 4);
        } else {
            Event::addEvent('A user\'s session has timed out.', new User(0), 4);
        }
        session_destroy();
        setcookie('user', null, time() - 60 * 60);
        ?>
    <script>
        window.location = 'index.php';
    </script>
    <?php 
    }
}
开发者ID:Keshaun1222,项目名称:IRIN,代码行数:31,代码来源:logout.php

示例7: delete_session_category

 /**
  * Delete sessions categories
  * @author Jhon Hinojosa <jhon.hinojosa@dokeos.com>, from existing code
  * @param	array	id_checked
  * @param	bool	include delete session
  * @param	bool	optional, true if the function is called by a webservice, false otherwise.
  * @return	void	Nothing, or false on error
  * The parameters is a array to delete sessions
  * */
 public static function delete_session_category($id_checked, $delete_session = false, $from_ws = false)
 {
     $tbl_session_category = Database::get_main_table(TABLE_MAIN_SESSION_CATEGORY);
     $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
     if (is_array($id_checked)) {
         $id_checked = Database::escape_string(implode(',', $id_checked));
     } else {
         $id_checked = intval($id_checked);
     }
     //Setting session_category_id to 0
     $sql = "UPDATE {$tbl_session} SET session_category_id = 0\n                WHERE session_category_id IN (" . $id_checked . ")";
     Database::query($sql);
     $sql = "SELECT id FROM {$tbl_session} WHERE session_category_id IN (" . $id_checked . ")";
     $result = Database::query($sql);
     while ($rows = Database::fetch_array($result)) {
         $session_id = $rows['id'];
         if ($delete_session) {
             if ($from_ws) {
                 SessionManager::delete($session_id, true);
             } else {
                 SessionManager::delete($session_id);
             }
         }
     }
     $sql = "DELETE FROM {$tbl_session_category} WHERE id IN (" . $id_checked . ")";
     Database::query($sql);
     // Add event to system log
     $user_id = api_get_user_id();
     Event::addEvent(LOG_SESSION_CATEGORY_DELETE, LOG_SESSION_CATEGORY_ID, $id_checked, api_get_utc_datetime(), $user_id);
     return true;
 }
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:40,代码来源:sessionmanager.lib.php

示例8: MailException

                         $to = $email;
                         $subject = 'IRIN - New Account';
                         $headers = "MIME-Version: 1.0" . "\r\n";
                         $headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n";
                         $headers .= "From: IRIN <DoNotReply@irin.eotir.com>" . "\r\n";
                         $message = 'A new account has been created with your email address.<br /><br /><b>Login ID:</b> ' . $login . '<br /><b>New Password:</b> ' . $password . '<br /><b>Name:</b> ' . $name;
                         //mail($to, $subject, $message, $headers);
                         $mail->setFrom('DoNotReply@eotir.com', 'IRIN');
                         $mail->addAddress($to);
                         $mail->Subject = $subject;
                         $mail->Body = $message;
                         if (!$mail->send()) {
                             throw new MailException($mail->ErrorInfo);
                         }
                         echo 'true';
                         Event::addEvent($name . '\'s account has been created.', $_SESSION['user'], 1);
                     }
                 }
             }
         }
     } else {
         if ($action == 'switch') {
             if (!isset($_SESSION['real'])) {
                 $_SESSION['real'] = $_SESSION['user'];
             }
             $_SESSION['user'] = new User($_GET['id']);
             ?>
 <script>
     window.location = 'main.php';
 </script>
 <?php 
开发者ID:Keshaun1222,项目名称:IRIN,代码行数:31,代码来源:users.php

示例9: switch

        <?php 
        } else {
            if ($do == 'add') {
                $version = $_POST['version'];
                ?>
        <?php 
                switch ($_POST['ver']) {
                    case "alpha":
                        $version .= '&alpha;';
                        break;
                    case "beta":
                        $version .= '&beta;';
                        break;
                }
                Version::create($version);
                Event::addEvent('Version ' . $version . ' has been added.', $_SESSION['user'], 1);
            }
        }
    } else {
        if ($action == 'current') {
            $version = new Version($_GET['id']);
            $version->makeCurrent();
            Event::addEvent('Version ' . $version->getVersion() . ' is now the current version.', $_SESSION['user'], 2);
            ?>
    <script>
        load('version', 'none', 'none');
    </script>
    <?php 
        }
    }
}
开发者ID:Keshaun1222,项目名称:IRIN,代码行数:31,代码来源:version.php

示例10: Event

session_start();
require_once '../classes/connection.class.php';
require_once '../classes/event.class.php';
$addeventobj = new Event();
/*echo '<pre>';
print_r($addeventobj);
echo '</pre>';
exit;
*/
$event_id = mysqli_real_escape_string($addeventobj->conxn, $_POST['event_id']);
$event_title = mysqli_real_escape_string($addeventobj->conxn, $_POST['title']);
$event_desc = mysqli_real_escape_string($addeventobj->conxn, $_POST['desc']);
$event_date = mysqli_real_escape_string($addeventobj->conxn, $_POST['date']);
$addeventobj->setEventID($event_id);
$addeventobj->setEventTitle($event_title);
$addeventobj->setEventDesc($event_desc);
$addeventobj->setEventDate($event_date);
//$adduserobj->setError($er);
//$adduserobj->setMessage($msg);
$addeventobj->addEvent();
/*echo '<pre>';
print_r ($adduserobj);
echo '</pre>';
exit;*/
if ($addeventobj) {
    header('location:../index.php?page=event&action=view');
    $_SESSION['msg'] = $addeventobj->msg = "The event has been added sucessfully";
} else {
    echo $_SESSION['msg'] = $addeventobj->msg = "Sorry the event has not been  added, please try again later";
}
开发者ID:Ukesh2010,项目名称:aila,代码行数:30,代码来源:process_add_event.php

示例11: delete

 /**
  * @param int $id
  * @return bool
  */
 public function delete($id)
 {
     if (parent::delete($id)) {
         SessionManager::clear_session_ref_promotion($id);
         Event::addEvent(LOG_PROMOTION_DELETE, LOG_PROMOTION_ID, $id, api_get_utc_datetime(), api_get_user_id());
     } else {
         return false;
     }
 }
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:13,代码来源:promotion.lib.php

示例12: lock_all_items

 /**
  * @param $locked
  */
 public function lock_all_items($locked)
 {
     if (api_get_setting('gradebook.gradebook_locking_enabled') == 'true') {
         $this->lock($locked);
         $evals_to_lock = $this->get_evaluations();
         if (!empty($evals_to_lock)) {
             foreach ($evals_to_lock as $item) {
                 $item->lock($locked);
             }
         }
         $link_to_lock = $this->get_links();
         if (!empty($link_to_lock)) {
             foreach ($link_to_lock as $item) {
                 $item->lock($locked);
             }
         }
         $event_type = LOG_GRADEBOOK_UNLOCKED;
         if ($locked == 1) {
             $event_type = LOG_GRADEBOOK_LOCKED;
         }
         Event::addEvent($event_type, LOG_GRADEBOOK_ID, $this->id);
     }
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:26,代码来源:category.class.php

示例13: update_user_role

 /**
  * Updates the group_rel_user table  with a given user and group ids
  * @author Julio Montoya
  * @param int  $user_id
  * @param int  $group_id
  * @param int  $relation_type
  *
  * @return bool
  **/
 public static function update_user_role($user_id, $group_id, $relation_type = GROUP_USER_PERMISSION_READER)
 {
     if (empty($user_id) || empty($group_id) || empty($relation_type)) {
         return false;
     }
     $em = Database::getManager();
     $group_id = intval($group_id);
     $user_id = intval($user_id);
     $usergroupUser = $em->getRepository('ChamiloCoreBundle:UsergroupRelUser')->findOneBy(['user' => $user_id, 'usergroup' => $group_id]);
     if (!$usergroupUser) {
         return false;
     }
     $usergroupUser->setRelationType($relation_type);
     $em->merge($usergroupUser);
     $em->flush();
     Event::addEvent(LOG_GROUP_PORTAL_USER_UPDATE_ROLE, LOG_GROUP_PORTAL_REL_USER_ARRAY, array('user_id' => $user_id, 'group_id' => $group_id, 'relation_type' => $relation_type));
     return true;
 }
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:27,代码来源:group_portal_manager.lib.php

示例14: display_wiki_entry

 /**
  * This function displays a wiki entry
  * @author Patrick Cool <patrick.cool@ugent.be>, Ghent University
  * @author Juan Carlos Raña Trabado
  * @param string $newtitle
  * @return string html code
  **/
 public function display_wiki_entry($newtitle)
 {
     $tbl_wiki = $this->tbl_wiki;
     $tbl_wiki_conf = $this->tbl_wiki_conf;
     $condition_session = $this->condition_session;
     $groupfilter = $this->groupfilter;
     $page = $this->page;
     $session_id = api_get_session_id();
     $course_id = api_get_course_int_id();
     if ($newtitle) {
         $pageMIX = $newtitle;
         //display the page after it is created
     } else {
         $pageMIX = $page;
         //display current page
     }
     $filter = null;
     if (isset($_GET['view']) && $_GET['view']) {
         $_clean['view'] = (int) Database::escape_string($_GET['view']);
         $filter = ' AND w.id="' . $_clean['view'] . '"';
     }
     //first, check page visibility in the first page version
     $sql = 'SELECT * FROM ' . $tbl_wiki . '
             WHERE
                 c_id = ' . $course_id . ' AND
                 reflink="' . Database::escape_string($pageMIX) . '" AND
                ' . $groupfilter . $condition_session . '
           ORDER BY id ASC';
     $result = Database::query($sql);
     $row = Database::fetch_array($result);
     $KeyVisibility = $row['visibility'];
     // second, show the last version
     $sql = 'SELECT * FROM ' . $tbl_wiki . ' w , ' . $tbl_wiki_conf . ' wc
             WHERE
                 wc.c_id 	  = ' . $course_id . ' AND
                 w.c_id 		  = ' . $course_id . ' AND
                 wc.page_id	  = w.page_id AND
                 w.reflink	  = "' . Database::escape_string($pageMIX) . '" AND
                 w.session_id  = ' . $session_id . ' AND
                 w.' . $groupfilter . '  ' . $filter . '
             ORDER BY id DESC';
     $result = Database::query($sql);
     $row = Database::fetch_array($result);
     // we do not need a while loop since we are always displaying the last version
     //log users access to wiki (page_id)
     if (!empty($row['page_id'])) {
         Event::addEvent(LOG_WIKI_ACCESS, LOG_WIKI_PAGE_ID, $row['page_id']);
     }
     //update visits
     if ($row['id']) {
         $sql = 'UPDATE ' . $tbl_wiki . ' SET hits=(hits+1) WHERE c_id = ' . $course_id . ' AND id=' . $row['id'] . '';
         Database::query($sql);
     }
     // if both are empty and we are displaying the index page then we display the default text.
     if ($row['content'] == '' and $row['title'] == '' and $page == 'index') {
         if (api_is_allowed_to_edit(false, true) || api_is_platform_admin() || GroupManager::is_user_in_group(api_get_user_id(), api_get_group_id())) {
             //Table structure for better export to pdf
             $default_table_for_content_Start = '<table align="center" border="0"><tr><td align="center">';
             $default_table_for_content_End = '</td></tr></table>';
             $content = $default_table_for_content_Start . sprintf(get_lang('DefaultContent'), api_get_path(WEB_IMG_PATH)) . $default_table_for_content_End;
             $title = get_lang('DefaultTitle');
         } else {
             return self::setMessage(Display::display_normal_message(get_lang('WikiStandBy'), false, true));
         }
     } else {
         $content = Security::remove_XSS(api_html_entity_decode($row['content']), COURSEMANAGERLOWSECURITY);
         $title = api_html_entity_decode($row['title']);
     }
     //assignment mode: identify page type
     $icon_assignment = null;
     if ($row['assignment'] == 1) {
         $icon_assignment = Display::return_icon('wiki_assignment.png', get_lang('AssignmentDescExtra'), '', ICON_SIZE_SMALL);
     } elseif ($row['assignment'] == 2) {
         $icon_assignment = Display::return_icon('wiki_work.png', get_lang('AssignmentWork'), '', ICON_SIZE_SMALL);
     }
     //task mode
     $icon_task = null;
     if (!empty($row['task'])) {
         $icon_task = Display::return_icon('wiki_task.png', get_lang('StandardTask'), '', ICON_SIZE_SMALL);
     }
     //Show page. Show page to all users if isn't hide page. Mode assignments: if student is the author, can view
     if ($KeyVisibility == "1" || api_is_allowed_to_edit(false, true) || api_is_platform_admin() || $row['assignment'] == 2 && $KeyVisibility == "0" && api_get_user_id() == $row['user_id']) {
         echo '<div id="wikititle">';
         $protect_page = null;
         $lock_unlock_protect = null;
         // page action: protecting (locking) the page
         if (api_is_allowed_to_edit(false, true) || api_is_platform_admin()) {
             if (self::check_protect_page() == 1) {
                 $protect_page = Display::return_icon('lock.png', get_lang('PageLockedExtra'), '', ICON_SIZE_SMALL);
                 $lock_unlock_protect = 'unlock';
             } else {
                 $protect_page = Display::return_icon('unlock.png', get_lang('PageUnlockedExtra'), '', ICON_SIZE_SMALL);
                 $lock_unlock_protect = 'lock';
//.........这里部分代码省略.........
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:101,代码来源:wiki.inc.php

示例15: set_platform_language

 /**
  * Set platform language
  * @param Integer The language id
  * @return void()
  */
 public static function set_platform_language($language_id)
 {
     if (empty($language_id) or intval($language_id) != $language_id) {
         return false;
     }
     $tbl_admin_languages = Database::get_main_table(TABLE_MAIN_LANGUAGE);
     $tbl_settings_current = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
     $sql_update = "SELECT english_name FROM " . $tbl_admin_languages . " WHERE id='" . Database::escape_string($language_id) . "'";
     $result = Database::query($sql_update);
     $lang = Database::fetch_array($result);
     $sql_update_2 = "UPDATE " . $tbl_settings_current . " SET selected_value='" . $lang['english_name'] . "' WHERE variable='platformLanguage'";
     $result_2 = Database::query($sql_update_2);
     Event::addEvent(LOG_PLATFORM_LANGUAGE_CHANGE, LOG_PLATFORM_LANGUAGE, $lang['english_name']);
     return $result_2 !== false;
 }
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:20,代码来源:sub_language.class.php


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