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


PHP api_is_element_in_the_session函数代码示例

本文整理汇总了PHP中api_is_element_in_the_session函数的典型用法代码示例。如果您正苦于以下问题:PHP api_is_element_in_the_session函数的具体用法?PHP api_is_element_in_the_session怎么用?PHP api_is_element_in_the_session使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: unsubscribe_all_users

 /**
  * Unsubscribe all users from one or more groups
  * @param mixed $group_id Can be an array with group-id's or a single group-id
  * @return bool TRUE if successful
  */
 public static function unsubscribe_all_users($group_ids)
 {
     $course_id = api_get_course_int_id();
     $group_ids = is_array($group_ids) ? $group_ids : array($group_ids);
     $group_ids = array_map('intval', $group_ids);
     if (count($group_ids) > 0) {
         if (api_is_course_coach()) {
             for ($i = 0; $i < count($group_ids); $i++) {
                 if (!api_is_element_in_the_session(TOOL_GROUP, $group_ids[$i])) {
                     array_splice($group_ids, $i, 1);
                     $i--;
                 }
             }
             if (count($group_ids) == 0) {
                 return false;
             }
         }
         $table_group_user = Database::get_course_table(TABLE_GROUP_USER);
         $sql = 'DELETE FROM ' . $table_group_user . ' WHERE group_id IN (' . implode(',', $group_ids) . ') AND c_id = ' . $course_id;
         $result = Database::query($sql);
         return $result;
     }
     return true;
 }
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:29,代码来源:groupmanager.lib.php

示例2: display_agenda_items

         }
     }
     display_agenda_items();
     break;
 case "showhide":
     $id = (int) $_GET['id'];
     if (!(api_is_course_coach() && !api_is_element_in_the_session(TOOL_AGENDA, $id))) {
         // a coach can only delete an element belonging to his session
         showhide_agenda_item($id);
     }
     display_agenda_items();
     break;
 case "announce":
     //copying the agenda item into an announcement
     $id = (int) $_GET['id'];
     if (!(api_is_course_coach() && !api_is_element_in_the_session(TOOL_AGENDA, $id))) {
         // a coach can only delete an element belonging to his session
         $ann_id = store_agenda_item_as_announcement($id);
         $tool_group_link = isset($_SESSION['toolgroup']) ? '&toolgroup=' . $_SESSION['toolgroup'] : '';
         echo '<br />';
         Display::display_normal_message(get_lang('CopiedAsAnnouncement') . '<a href="../announcements/announcements.php?id=' . $ann_id . $tool_group_link . '">' . get_lang('NewAnnouncement') . '</a>', false);
     }
     display_agenda_items();
     break;
 case "delete_attach":
     //delete attachment file
     $id_attach = (int) $_GET['id_attach'];
     if (!empty($id_attach)) {
         delete_attachment_file($id_attach);
     }
     display_agenda_items();
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:31,代码来源:calendar.php

示例3: header

     break;
 case 'delete_attachment':
     $id = $_GET['id_attach'];
     if (api_is_allowed_to_edit()) {
         AnnouncementManager::delete_announcement_attachment_file($id);
     }
     header('Location: ' . $homeUrl);
     exit;
     break;
 case 'showhide':
     if (!isset($_GET['isStudentView']) || $_GET['isStudentView'] != 'false') {
         if (isset($_GET['id']) && $_GET['id']) {
             if ($sessionId != 0 && api_is_allowed_to_session_edit(false, true) == false) {
                 api_not_allowed();
             }
             if (!api_is_course_coach() || api_is_element_in_the_session(TOOL_ANNOUNCEMENT, $_GET['id'])) {
                 AnnouncementManager::change_visibility_announcement($_course, $_GET['id']);
                 Display::addFlash(Display::return_message(get_lang('VisibilityChanged')));
                 header('Location: ' . $homeUrl);
                 exit;
             }
         }
     }
     break;
 case 'add':
 case 'modify':
     if ($sessionId != 0 && api_is_allowed_to_session_edit(false, true) == false) {
         api_not_allowed(true);
     }
     // DISPLAY ADD ANNOUNCEMENT COMMAND
     $id = isset($_GET['id']) ? intval($_GET['id']) : 0;
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:31,代码来源:announcements.php

示例4: fill_groups_list

 /**
  *
  * See : fill_groups
  *       Fill the groups with students.
  *
  * note : optimize fill_groups_list <--> fill_groups
  * @param array $group_ids
  * @return array|bool
  */
 public static function fill_groups_list($group_ids)
 {
     $group_ids = is_array($group_ids) ? $group_ids : array($group_ids);
     $group_ids = array_map('intval', $group_ids);
     if (api_is_course_coach()) {
         for ($i = 0; $i < count($group_ids); $i++) {
             if (!api_is_element_in_the_session(TOOL_GROUP, $group_ids[$i])) {
                 array_splice($group_ids, $i, 1);
                 $i--;
             }
         }
         if (count($group_ids) == 0) {
             return false;
         }
     }
     $_course = api_get_course_info();
     $category = self::get_category_from_group($group_ids[0]);
     $number_groups_per_user = self::GROUP_PER_MEMBER_NO_LIMIT;
     $categoryId = 0;
     if ($category) {
         $groups_per_user = $category['groups_per_user'];
         $number_groups_per_user = $groups_per_user == self::GROUP_PER_MEMBER_NO_LIMIT ? self::INFINITE : $groups_per_user;
         $categoryId = $category['id'];
     }
     $group_table = Database::get_course_table(TABLE_GROUP);
     $group_user_table = Database::get_course_table(TABLE_GROUP_USER);
     $session_id = api_get_session_id();
     $complete_user_list = CourseManager::get_real_and_linked_user_list($_course['code'], true, $session_id);
     $course_id = api_get_course_int_id();
     /*
      * Retrieve all the groups where enrollment is still allowed
      * (reverse) ordered by the number of place available
      */
     $sql = "SELECT g.id gid, count(ug.user_id) count_users, g.max_student\n                FROM " . $group_table . " g\n                LEFT JOIN  " . $group_user_table . " ug\n                ON    g.id = ug.group_id\n                WHERE   g.c_id = {$course_id} AND\n                        ug.c_id = {$course_id} AND\n                        g.id IN (" . implode(',', $group_ids) . ")\n                GROUP BY (g.id)";
     $sql_result = Database::query($sql);
     $group_available_place = array();
     while ($group = Database::fetch_array($sql_result, 'ASSOC')) {
         if (!empty($group['max_student'])) {
             $places = intval($group['max_student'] - $group['count_users']);
         } else {
             $places = self::MEMBER_PER_GROUP_NO_LIMIT;
         }
         $group_available_place[$group['gid']] = $places;
     }
     /*
      * Retrieve course users (reverse) ordered by the number
      * of group they are already enrolled
      */
     for ($i = 0; $i < count($complete_user_list); $i++) {
         // find # of groups the user is enrolled in
         $number_of_groups = self::user_in_number_of_groups($complete_user_list[$i]["user_id"], $categoryId);
         // add # of groups to user list
         $complete_user_list[$i]['number_groups_left'] = $number_groups_per_user - $number_of_groups;
     }
     //first sort by user_id to filter out duplicates
     $complete_user_list = TableSort::sort_table($complete_user_list, 'user_id');
     $complete_user_list = self::filter_duplicates($complete_user_list, 'user_id');
     //$complete_user_list = self :: filter_only_students($complete_user_list);
     //now sort by # of group left
     $complete_user_list = TableSort::sort_table($complete_user_list, 'number_groups_left', SORT_DESC);
     return $complete_user_list;
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:71,代码来源:groupmanager.lib.php

示例5: isset

 * 	@version $Id: create_new_survey.php 22297 2009-07-22 22:08:30Z cfasanando $
 *
 * 	@todo only the available platform languages should be used => need an
 *  api get_languages and and api_get_available_languages (or a parameter)
 */
require_once '../inc/global.inc.php';
$this_section = SECTION_COURSES;
// Database table definitions
$table_survey = Database::get_course_table(TABLE_SURVEY);
$table_user = Database::get_main_table(TABLE_MAIN_USER);
$table_course = Database::get_main_table(TABLE_MAIN_COURSE);
$table_gradebook_link = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
/** @todo this has to be moved to a more appropriate place (after the display_header of the code) */
// If user is not teacher or if he's a coach trying to access an element out of his session
if (!api_is_allowed_to_edit()) {
    if (!api_is_course_coach() || !empty($_GET['survey_id']) && !api_is_element_in_the_session(TOOL_SURVEY, $_GET['survey_id'])) {
        api_not_allowed(true);
        exit;
    }
}
// Getting the survey information
$survey_id = isset($_GET['survey_id']) ? intval($_GET['survey_id']) : null;
$survey_data = SurveyManager::get_survey($survey_id);
// Additional information
$course_id = api_get_course_id();
$session_id = api_get_session_id();
$gradebook_link_type = 8;
$urlname = isset($survey_data['title']) ? strip_tags($survey_data['title']) : null;
// Breadcrumbs
if ($_GET['action'] == 'add') {
    $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH) . 'survey/survey_list.php?' . api_get_cidreq(), 'name' => get_lang('SurveyList'));
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:31,代码来源:create_new_survey.php

示例6: modify_filter

 /**
  * This function changes the modify column of the sortable table
  *
  * @param integer $survey_id the id of the survey
  * @param bool $drh
  * @return string html code that are the actions that can be performed on any survey
  *
  * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
  * @version January 2007
  */
 static function modify_filter($survey_id, $drh = false)
 {
     $survey_id = Security::remove_XSS($survey_id);
     $return = '';
     if ($drh) {
         return '<a href="' . api_get_path(WEB_CODE_PATH) . 'survey/reporting.php?' . api_get_cidreq() . '&survey_id=' . $survey_id . '">' . Display::return_icon('stats.png', get_lang('Reporting'), '', ICON_SIZE_SMALL) . '</a>';
     }
     // Coach can see that only if the survey is in his session
     if (api_is_allowed_to_edit() || api_is_element_in_the_session(TOOL_SURVEY, $survey_id)) {
         $return .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'survey/create_new_survey.php?' . api_get_cidreq() . '&action=edit&survey_id=' . $survey_id . '">' . Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL) . '</a>';
         if (SurveyManager::survey_generation_hash_available()) {
             $return .= Display::url(Display::return_icon('new_link.png', get_lang('GenerateSurveyAccessLink'), '', ICON_SIZE_SMALL), api_get_path(WEB_CODE_PATH) . 'survey/generate_link.php?survey_id=' . $survey_id . '&' . api_get_cidreq());
         }
         $return .= Display::url(Display::return_icon('copy.png', get_lang('DuplicateSurvey'), '', ICON_SIZE_SMALL), 'survey_list.php?action=copy_survey&survey_id=' . $survey_id . '&' . api_get_cidreq());
         $return .= ' <a href="' . api_get_path(WEB_CODE_PATH) . 'survey/survey_list.php?' . api_get_cidreq() . '&action=empty&survey_id=' . $survey_id . '" onclick="javascript: if(!confirm(\'' . addslashes(api_htmlentities(get_lang("EmptySurvey") . '?')) . '\')) return false;">' . Display::return_icon('clean.png', get_lang('EmptySurvey'), '', ICON_SIZE_SMALL) . '</a>&nbsp;';
     }
     $return .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'survey/preview.php?' . api_get_cidreq() . '&survey_id=' . $survey_id . '">' . Display::return_icon('preview_view.png', get_lang('Preview'), '', ICON_SIZE_SMALL) . '</a>&nbsp;';
     $return .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'survey/survey_invite.php?' . api_get_cidreq() . '&survey_id=' . $survey_id . '">' . Display::return_icon('mail_send.png', get_lang('Publish'), '', ICON_SIZE_SMALL) . '</a>&nbsp;';
     $return .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'survey/reporting.php?' . api_get_cidreq() . '&survey_id=' . $survey_id . '">' . Display::return_icon('stats.png', get_lang('Reporting'), '', ICON_SIZE_SMALL) . '</a>';
     if (api_is_allowed_to_edit() || api_is_element_in_the_session(TOOL_SURVEY, $survey_id)) {
         $return .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'survey/survey_list.php?' . api_get_cidreq() . '&action=delete&survey_id=' . $survey_id . '" onclick="javascript: if(!confirm(\'' . addslashes(api_htmlentities(get_lang("DeleteSurvey") . '?', ENT_QUOTES)) . '\')) return false;">' . Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) . '</a>&nbsp;';
     }
     return $return;
 }
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:34,代码来源:survey.lib.php

示例7: setFocus

        setFocus();
    });
</script>';

// Database table definitions
$table_survey = Database :: get_course_table(TABLE_SURVEY);
$table_user = Database :: get_main_table(TABLE_MAIN_USER);
$table_course = Database :: get_main_table(TABLE_MAIN_COURSE);
$table_gradebook_link = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK);

/** @todo this has to be moved to a more appropriate place (after the display_header of the code) */
// If user is not teacher or if he's a coach trying to access an element out of his session
if (!api_is_allowed_to_edit()) {
    if (!api_is_course_coach() ||
        (!empty($_GET['survey_id']) &&
        !api_is_element_in_the_session(TOOL_SURVEY, $_GET['survey_id']))
    ) {
        api_not_allowed(true);
        exit;
    }
}

// Getting the survey information
$survey_id = isset($_GET['survey_id']) ? intval($_GET['survey_id']) : null;
$survey_data = survey_manager::get_survey($survey_id);

// Additional information
$course_id = api_get_course_id();
$session_id = api_get_session_id();
$gradebook_link_type = 8;
$urlname = isset($survey_data['title']) ? strip_tags($survey_data['title']) : null;
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:31,代码来源:create_new_survey.php

示例8: api_get_session_id

    }
    // If the survey is shared => also delete the shared content
    if (is_numeric($survey_data['survey_share'])) {
        survey_manager::delete_survey($survey_data['survey_share'], true);
    }
    $return = survey_manager::delete_survey($_GET['survey_id']);
    if ($return) {
        Display::display_confirmation_message(get_lang('SurveyDeleted'), false);
    } else {
        Display::display_error_message(get_lang('ErrorOccurred'), false);
    }
}
if (isset($_GET['action']) && $_GET['action'] == 'empty') {
    $mysession = api_get_session_id();
    if ($mysession != 0) {
        if (!((api_is_course_coach() || api_is_platform_admin()) && api_is_element_in_the_session(TOOL_SURVEY, $_GET['survey_id']))) {
            // The coach can't empty a survey not belonging to his session
            api_not_allowed();
            exit;
        }
    } else {
        if (!(api_is_course_admin() || api_is_platform_admin())) {
            api_not_allowed();
            exit;
        }
    }
    $return = survey_manager::empty_survey(intval($_GET['survey_id']));
    if ($return) {
        Display::display_confirmation_message(get_lang('SurveyEmptied'), false);
    } else {
        Display::display_error_message(get_lang('ErrorOccurred'), false);
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:31,代码来源:survey_list.php

示例9: getAnnouncements


//.........这里部分代码省略.........
                 if ($allowUserEditSetting && !api_is_anonymous()) {
                     $cond_user_id = " AND (\n                            ip.lastedit_user_id = '" . $user_id . "' OR ip.to_group_id='0' OR ip.to_group_id IS NULL\n                        )";
                 } else {
                     $cond_user_id = " AND ip.to_group_id='0' OR ip.to_group_id IS NULL ";
                 }
                 $sql = "SELECT announcement.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.insert_date\n\t\t\t\t\t\tFROM {$tbl_announcement} announcement, {$tbl_item_property} ip\n\t\t\t\t\t\tWHERE\n                            announcement.c_id = {$course_id} AND\n                            ip.c_id = {$course_id} AND\n                            announcement.id = ip.ref AND\n                            ip.tool='announcement'\n                            {$cond_user_id}\n                            {$condition_session} AND\n                            ip.visibility='1' AND\n                            announcement.session_id IN ( 0," . api_get_session_id() . ")";
             }
         }
     }
     $result = Database::query($sql);
     $num_rows = Database::num_rows($result);
     $html = null;
     if ($num_rows == 0) {
         if ((api_is_allowed_to_edit(false, true) or api_get_course_setting('allow_user_edit_announcement') && !api_is_anonymous()) and (empty($_GET['origin']) or $_GET['origin'] !== 'learnpath')) {
             $html .= '<div id="no-data-view">';
             $html .= '<h3>' . get_lang('Announcements') . '</h3>';
             $html .= Display::return_icon('valves.png', '', array(), 64);
             $html .= '<div class="controls">';
             $html .= Display::url(get_lang('AddAnnouncement'), api_get_self() . "?" . api_get_cidreq() . "&action=add", array('class' => 'btn btn-primary'));
             $html .= '</div>';
             $html .= '</div>';
         } else {
             $html = Display::return_message(get_lang('NoAnnouncements'), 'warning');
         }
         return $html;
     }
     $iterator = 1;
     $bottomAnnouncement = $announcement_number;
     $origin = null;
     $html .= '<table width="100%" class="data_table announcements-list">';
     $ths = Display::tag('th', get_lang('Title'));
     $ths .= Display::tag('th', get_lang('By'));
     $ths .= Display::tag('th', get_lang('LastUpdateDate'));
     if (api_is_allowed_to_edit(false, true) or api_is_course_coach() && api_is_element_in_the_session(TOOL_ANNOUNCEMENT, $myrow['id']) or api_get_course_setting('allow_user_edit_announcement') && !api_is_anonymous()) {
         $ths .= Display::tag('th', get_lang('Modify'));
     }
     $html .= Display::tag('tr', $ths);
     $displayed = array();
     while ($myrow = Database::fetch_array($result, 'ASSOC')) {
         if (!in_array($myrow['id'], $displayed)) {
             $sent_to_icon = '';
             // the email icon
             if ($myrow['email_sent'] == '1') {
                 $sent_to_icon = ' ' . Display::return_icon('email.gif', get_lang('AnnounceSentByEmail'));
             }
             $title = $myrow['title'] . $sent_to_icon;
             $item_visibility = api_get_item_visibility($_course, TOOL_ANNOUNCEMENT, $myrow['id'], $session_id);
             $myrow['visibility'] = $item_visibility;
             // the styles
             if ($myrow['visibility'] == '0') {
                 $style = 'invisible';
             } else {
                 $style = '';
             }
             $html .= '<tr class="announcements-list-line">';
             // show attachment list
             $attachment_list = AnnouncementManager::get_attachment($myrow['id']);
             $attachment_icon = '';
             if (count($attachment_list) > 0) {
                 $attachment_icon = ' ' . Display::return_icon('attachment.gif', get_lang('Attachment'));
             }
             /* TITLE */
             $user_info = api_get_user_info($myrow['insert_user_id']);
             $username = sprintf(get_lang("LoginX"), $user_info['username']);
             $username_span = Display::tag('span', api_get_person_name($user_info['firstName'], $user_info['lastName']), array('title' => $username));
             $title = Display::url($title . $attachment_icon, api_get_self() . '?' . api_get_cidreq() . '&action=view&id=' . $myrow['id']);
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:67,代码来源:AnnouncementManager.php

示例10: api_get_user_info

 $user_info = api_get_user_info($myrow['insert_user_id']);
 $username = sprintf(get_lang("LoginX"), $user_info['username']);
 $username_span = Display::tag('span', api_get_person_name($user_info['firstName'], $user_info['lastName']), array('title' => $username));
 echo Display::tag('td', $username_span, array('class' => 'announcements-list-line-by-user'));
 $sent_to_list = array();
 $sent_to_list = AnnouncementManager::sent_to('announcement', $myrow['id']);
 $sent_to_form = AnnouncementManager::sent_to_form($sent_to_list);
 echo '<td class="announcements-list-line-by-user">' . substr($sent_to_form, 0, 45) . ' ';
 if (strlen($sent_to_form) > 45) {
     echo '...';
 }
 '</td>';
 echo Display::tag('td', api_convert_and_format_date($myrow['insert_date'], DATE_TIME_FORMAT_SHORT), array('class' => 'announcements-list-line-datetime'));
 // we can edit if : we are the teacher OR the element belongs to the session we are coaching OR the option to allow users to edit is on
 $modify_icons = '';
 if (api_is_allowed_to_edit(false, true) or api_is_course_coach() && api_is_element_in_the_session(TOOL_ANNOUNCEMENT, $myrow['id']) or api_get_course_setting('allow_user_edit_announcement') && !api_is_anonymous()) {
     $modify_icons = "<a href=\"" . api_get_self() . "?" . api_get_cidreq() . "&action=modify&id=" . $myrow['id'] . "\">" . Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL) . "</a>";
     if ($myrow['visibility'] == 1) {
         $image_visibility = "visible";
         $alt_visibility = get_lang('Hide');
     } else {
         $image_visibility = "invisible";
         $alt_visibility = get_lang('Visible');
     }
     $modify_icons .= "<a href=\"" . api_get_self() . "?" . api_get_cidreq() . "&origin=" . $origin . "&action=showhide&id=" . $myrow['id'] . "&sec_token=" . $stok . "\">" . Display::return_icon($image_visibility . '.png', $alt_visibility, '', ICON_SIZE_SMALL) . "</a>";
     // DISPLAY MOVE UP COMMAND only if it is not the top announcement
     if ($iterator != 1) {
         $modify_icons .= "<a href=\"" . api_get_self() . "?" . api_get_cidreq() . "&up=" . $myrow["id"] . "&sec_token=" . $stok . "\">" . Display::return_icon('up.gif', get_lang('Up')) . "</a>";
     } else {
         $modify_icons .= Display::return_icon('up_na.gif', get_lang('Up'));
     }
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:31,代码来源:announcements.php

示例11: getAnnouncements


//.........这里部分代码省略.........
                 } else {
                     $cond_user_id = " AND (\n                            ip.to_user_id = {$user_id} AND (ip.to_group_id IS NULL OR ip.to_group_id IN (0, " . $group_id . "))\n                        )";
                 }
             }
             $sql = "SELECT {$select}\n                        FROM {$tbl_announcement} announcement,\n                        {$tbl_item_property} ip\n                        WHERE\n                            announcement.c_id = {$course_id} AND\n                            ip.c_id = {$course_id} AND\n                            announcement.id = ip.ref\n                            AND ip.tool='announcement'\n                            {$cond_user_id}\n                            {$condition_session}\n                            {$searchCondition}\n                            AND ip.visibility='1'\n                        ORDER BY display_order DESC";
         } else {
             if ($user_id) {
                 if ($allowUserEditSetting && !api_is_anonymous()) {
                     $cond_user_id = " AND (\n                            ip.lastedit_user_id = '" . api_get_user_id() . "' OR\n                            (ip.to_user_id='" . $user_id . "' AND (ip.to_group_id='0' OR ip.to_group_id IS NULL))\n                        ) ";
                 } else {
                     $cond_user_id = " AND (ip.to_user_id='" . $user_id . "' AND (ip.to_group_id='0' OR ip.to_group_id IS NULL) ) ";
                 }
                 $sql = "SELECT {$select}\n\t\t\t\t\t\tFROM {$tbl_announcement} announcement, {$tbl_item_property} ip\n\t\t\t\t\t\tWHERE\n    \t\t\t\t\t\tannouncement.c_id = {$course_id} AND\n\t\t\t\t\t\t\tip.c_id = {$course_id} AND\n    \t\t\t\t\t\tannouncement.id = ip.ref AND\n    \t\t\t\t\t\tip.tool='announcement'\n    \t\t\t\t\t\t{$cond_user_id}\n    \t\t\t\t\t\t{$condition_session}\n    \t\t\t\t\t\t{$searchCondition}\n    \t\t\t\t\t\tAND ip.visibility='1'\n    \t\t\t\t\t\tAND announcement.session_id IN(0, " . $session_id . ")\n\t\t\t\t\t\tORDER BY display_order DESC";
             } else {
                 if ($allowUserEditSetting && !api_is_anonymous()) {
                     $cond_user_id = " AND (\n                            ip.lastedit_user_id = '" . $user_id . "' OR ip.to_group_id='0' OR ip.to_group_id IS NULL\n                        )";
                 } else {
                     $cond_user_id = " AND ip.to_group_id='0' OR ip.to_group_id IS NULL ";
                 }
                 $sql = "SELECT {$select}\n\t\t\t\t\t\tFROM {$tbl_announcement} announcement, {$tbl_item_property} ip\n\t\t\t\t\t\tWHERE\n                            announcement.c_id = {$course_id} AND\n                            ip.c_id = {$course_id} AND\n                            announcement.id = ip.ref AND\n                            ip.tool='announcement'\n                            {$cond_user_id}\n                            {$condition_session}\n                            {$searchCondition}\n                            AND\n                            ip.visibility='1' AND\n                            announcement.session_id IN ( 0," . api_get_session_id() . ")";
             }
         }
     }
     if (!is_null($start) && !is_null($limit)) {
         $start = intval($start);
         $limit = intval($limit);
         $sql .= " LIMIT {$start}, {$limit}";
     }
     $result = Database::query($sql);
     if ($getCount) {
         $result = Database::fetch_array($result, 'ASSOC');
         return $result['count'];
     }
     $iterator = 1;
     $bottomAnnouncement = $announcement_number;
     $origin = null;
     $displayed = [];
     $results = [];
     $actionUrl = api_get_path(WEB_CODE_PATH) . 'announcements/announcements.php?' . api_get_cidreq();
     while ($myrow = Database::fetch_array($result, 'ASSOC')) {
         if (!in_array($myrow['id'], $displayed)) {
             $sent_to_icon = '';
             // the email icon
             if ($myrow['email_sent'] == '1') {
                 $sent_to_icon = ' ' . Display::return_icon('email.gif', get_lang('AnnounceSentByEmail'));
             }
             $title = $myrow['title'] . $sent_to_icon;
             $item_visibility = api_get_item_visibility($_course, TOOL_ANNOUNCEMENT, $myrow['id'], $session_id);
             $myrow['visibility'] = $item_visibility;
             // show attachment list
             $attachment_list = AnnouncementManager::get_attachment($myrow['id']);
             $attachment_icon = '';
             if (count($attachment_list) > 0) {
                 $attachment_icon = ' ' . Display::return_icon('attachment.gif', get_lang('Attachment'));
             }
             /* TITLE */
             $user_info = api_get_user_info($myrow['insert_user_id']);
             $username = sprintf(get_lang("LoginX"), $user_info['username']);
             $username_span = Display::tag('span', api_get_person_name($user_info['firstName'], $user_info['lastName']), array('title' => $username));
             $title = Display::url($title . $attachment_icon, $actionUrl . '&action=view&id=' . $myrow['id']);
             //$html .= Display::tag('td', $username_span, array('class' => 'announcements-list-line-by-user'));
             //$html .= Display::tag('td', api_convert_and_format_date($myrow['insert_date'], DATE_TIME_FORMAT_LONG), array('class' => 'announcements-list-line-datetime'));
             $modify_icons = '';
             // we can edit if : we are the teacher OR the element belongs to
             // the session we are coaching OR the option to allow users to edit is on
             if (api_is_allowed_to_edit(false, true) || api_is_course_coach() && api_is_element_in_the_session(TOOL_ANNOUNCEMENT, $myrow['id']) || api_get_course_setting('allow_user_edit_announcement') && !api_is_anonymous()) {
                 $modify_icons = "<a href=\"" . $actionUrl . "&action=modify&id=" . $myrow['id'] . "\">" . Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL) . "</a>";
                 if ($myrow['visibility'] == 1) {
                     $image_visibility = "visible";
                     $alt_visibility = get_lang('Hide');
                 } else {
                     $image_visibility = "invisible";
                     $alt_visibility = get_lang('Visible');
                 }
                 $modify_icons .= "<a href=\"" . $actionUrl . "&origin=" . $origin . "&action=showhide&id=" . $myrow['id'] . "&sec_token=" . $stok . "\">" . Display::return_icon($image_visibility . '.png', $alt_visibility, '', ICON_SIZE_SMALL) . "</a>";
                 // DISPLAY MOVE UP COMMAND only if it is not the top announcement
                 if ($iterator != 1) {
                     $modify_icons .= "<a href=\"" . $actionUrl . "&action=move&up=" . $myrow["id"] . "&sec_token=" . $stok . "\">" . Display::return_icon('up.gif', get_lang('Up')) . "</a>";
                 } else {
                     $modify_icons .= Display::return_icon('up_na.gif', get_lang('Up'));
                 }
                 if ($iterator < $bottomAnnouncement) {
                     $modify_icons .= "<a href=\"" . $actionUrl . "&action=move&down=" . $myrow["id"] . "&sec_token=" . $stok . "\">" . Display::return_icon('down.gif', get_lang('Down')) . "</a>";
                 } else {
                     $modify_icons .= Display::return_icon('down_na.gif', get_lang('Down'));
                 }
                 if (api_is_allowed_to_edit(false, true)) {
                     $modify_icons .= "<a href=\"" . $actionUrl . "&action=delete&id=" . $myrow['id'] . "&sec_token=" . $stok . "\" onclick=\"javascript:if(!confirm('" . addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, api_get_system_encoding())) . "')) return false;\">" . Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) . "</a>";
                 }
                 $iterator++;
             } else {
                 $modify_icons = Display::url(Display::return_icon('default.png'), $actionUrl . '&action=view&id=' . $myrow['id']);
             }
             $announcement = ['id' => $myrow["id"], 'title' => $title, 'username' => $username_span, 'insert_date' => api_convert_and_format_date($myrow['insert_date'], DATE_TIME_FORMAT_LONG), 'actions' => $modify_icons];
             $results[] = $announcement;
         }
         $displayed[] = $myrow['id'];
     }
     return $results;
 }
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:101,代码来源:AnnouncementManager.php

示例12: isset

/* For licensing terms, see /license.txt */
/**
 * Responses to AJAX calls
 */
require_once '../global.inc.php';
$action = isset($_REQUEST['a']) ? $_REQUEST['a'] : null;
$isAllowedToEdit = api_is_allowed_to_edit();
$courseInfo = api_get_course_info();
switch ($action) {
    case 'delete_item':
        if ($isAllowedToEdit) {
            if (empty($_REQUEST['id'])) {
                return false;
            }
            if (api_get_session_id() != 0 && api_is_allowed_to_session_edit(false, true) == false) {
                return false;
            }
            $list = explode(',', $_REQUEST['id']);
            foreach ($list as $itemId) {
                if (!api_is_course_coach() || api_is_element_in_the_session(TOOL_ANNOUNCEMENT, $itemId)) {
                    AnnouncementManager::delete_announcement($courseInfo, $itemId);
                }
            }
        }
        break;
    default:
        echo '';
        break;
}
exit;
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:30,代码来源:announcement.ajax.php

示例13: display_agenda_items


//.........这里部分代码省略.........
                $class = 'row_odd';
            }
            /* 	display: the icon, title, destinees of the item	 */
            echo '<tr class="' . $class . '">';
            //Title
            echo "<td>";
            $attach_icon = '';
            // attachment list
            $attachment_list = get_attachment($myrow['id']);
            if (!empty($attachment_list)) {
                $attach_icon = ' ' . Display::return_icon('attachment.gif', get_lang('Attachment'));
            }
            $title_class = '';
            if (isset($myrow['visibility']) && $myrow['visibility'] == 0) {
                $title_class = 'invisible';
            }
            switch ($myrow['calendar_type']) {
                case 'global':
                    $icon_type = Display::return_icon('view_remove.png', get_lang('GlobalEvent'), array(), 22);
                    echo $icon_type . ' ' . $myrow['title'] . $attach_icon;
                    break;
                case 'personal':
                    $icon_type = Display::return_icon('user.png', get_lang('   '), array(), 22);
                    echo $icon_type . ' ' . $myrow['title'] . $attach_icon;
                    break;
                case 'course':
                    $icon_type = Display::return_icon('course.png', get_lang('Course'), array(), 22);
                    $agenda_url = api_get_path(WEB_CODE_PATH) . 'calendar/agenda.php?agenda_id=' . $myrow['id'] . '&action=view';
                    echo Display::url($icon_type . ' ' . $myrow['title'] . $attach_icon, $agenda_url, array('class' => $title_class));
                    break;
            }
            echo '</td>';
            //Start date
            echo '<td>';
            if (!empty($myrow['start_date']) && $myrow['start_date'] != '0000-00-00 00:00:00') {
                echo api_format_date($myrow['start_date']);
            }
            echo '</td>';
            //End date
            echo '<td>';
            if (!empty($myrow['end_date']) && $myrow['end_date'] != '0000-00-00 00:00:00') {
                echo api_format_date($myrow['end_date']);
            }
            echo '</td>';
            /* Display: edit delete button (course admin only) */
            if (!$is_repeated && (api_is_allowed_to_edit(false, true) or api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous()) && $myrow['calendar_type'] == 'course') {
                echo '<td align="center">';
                if (!(api_is_course_coach() && !api_is_element_in_the_session(TOOL_AGENDA, $myrow['id']))) {
                    // a coach can only delete an element belonging to his session
                    $mylink = api_get_self() . '?' . api_get_cidreq() . '&origin=' . Security::remove_XSS($_GET['origin']) . '&id=' . $myrow['id'] . '&sort=' . $sort . '&col=' . $col . '&';
                    // edit
                    echo '<a href="' . $mylink . api_get_cidreq() . "&toolgroup=" . Security::remove_XSS($_GET['toolgroup']) . '&action=edit&id_attach=' . $attachment_list['id'] . '" title="' . get_lang("ModifyCalendarItem") . '">';
                    echo Display::return_icon('edit.png', get_lang('ModifyCalendarItem'), '', ICON_SIZE_SMALL) . "</a>";
                    echo '<a href="' . $mylink . api_get_cidreq() . "&toolgroup=" . Security::remove_XSS($_GET['toolgroup']) . '&action=announce" title="' . get_lang("AddAnnouncement") . '">';
                    echo Display::return_icon('new_announce.png', get_lang('AddAnnouncement'), array(), ICON_SIZE_SMALL) . "</a> ";
                    if ($myrow['visibility'] == 1) {
                        $image_visibility = "visible";
                        $text_visibility = get_lang("Hide");
                        $next_action = 0;
                    } else {
                        $image_visibility = "invisible";
                        $text_visibility = get_lang("Show");
                        $next_action = 1;
                    }
                    echo '<a href="' . $mylink . api_get_cidreq() . '&toolgroup=' . Security::remove_XSS($_GET['toolgroup']) . '&action=showhide&next_action=' . $next_action . '" title="' . $text_visibility . '">' . Display::return_icon($image_visibility . '.png', $text_visibility, '', ICON_SIZE_SMALL) . '</a> ';
                    echo "<a href=\"" . $mylink . api_get_cidreq() . "&toolgroup=" . Security::remove_XSS($_GET['toolgroup']) . "&action=delete\" onclick=\"javascript:if(!confirm('" . addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES, $charset)) . "')) return false;\"  title=\"" . get_lang("Delete") . "\"> ";
                    echo Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) . "&nbsp;</a>";
                }
                $mylink = 'ical_export.php?' . api_get_cidreq() . '&type=course&id=' . $myrow['id'];
                //echo '<a class="ical_export" href="'.$mylink.'&class=confidential" title="'.get_lang('ExportiCalConfidential').'">'.Display::return_icon($export_icon_high, get_lang('ExportiCalConfidential')).'</a> ';
                //echo '<a class="ical_export" href="'.$mylink.'&class=private" title="'.get_lang('ExportiCalPrivate').'">'.Display::return_icon($export_icon_low, get_lang('ExportiCalPrivate')).'</a> ';
                //echo '<a class="ical_export" href="'.$mylink.'&class=public" title="'.get_lang('ExportiCalPublic').'">'.Display::return_icon($export_icon, get_lang('ExportiCalPublic')).'</a> ';
                echo '<a href="#" onclick="javascript:win_print=window.open(\'print.php?id=' . $myrow['id'] . '\',\'popup\',\'left=100,top=100,width=700,height=500,scrollbars=1,resizable=0\'); win_print.focus(); return false;">' . Display::return_icon('printer.png', get_lang('Print'), '', ICON_SIZE_SMALL) . '</a>&nbsp;';
                echo '</td>';
            } else {
                if ($is_repeated && (api_is_allowed_to_edit(false, true) || api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous())) {
                    echo '<td align="center">';
                    echo get_lang('RepeatedEvent'), ' <a href="', api_get_self(), '?', api_get_cidreq(), '&agenda_id=', $myrow['parent_event_id'], '" alt="', get_lang('RepeatedEventViewOriginalEvent'), '">', get_lang('RepeatedEventViewOriginalEvent'), '</a>';
                    echo '</td>';
                }
                if ((api_is_allowed_to_edit(false, true) || api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous()) && ($myrow['calendar_type'] == 'personal' or $myrow['calendar_type'] == 'global')) {
                    echo '<td align="center">';
                    echo '</td>';
                }
            }
            $counter++;
            echo "</tr>";
        }
        // end while ($myrow=Database::fetch_array($result))
        echo "</table><br /><br />";
    }
    if (!empty($event_list)) {
        $event_list = api_substr($event_list, 0, -1);
    } else {
        $event_list = '0';
    }
    echo "<form name=\"event_list_form\"><input type=\"hidden\" name=\"event_list\" value=\"{$event_list}\" /></form>";
    // closing the layout table
    echo "</td>", "</tr>", "</table>";
}
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:101,代码来源:agenda.inc.php

示例14: display_one_agenda_item

/**
 * Displays only 1 agenda item. This is used when an agenda item is added to the learning path.
 * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
 */
function display_one_agenda_item($agenda_id)
{
    global $TABLEAGENDA;
    global $TABLE_ITEM_PROPERTY;
    global $select_month, $select_year;
    global $DaysShort, $DaysLong, $MonthsLong;
    global $dateFormatLong, $timeNoSecFormat, $charset;
    // getting the name of the groups
    $group_names = get_course_groups();
    $agenda_id = intval($agenda_id);
    if (!(api_is_allowed_to_edit(false, true) || api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous())) {
        $visibility_condition = " AND ip.visibility='1' ";
    }
    $sql = "SELECT agenda.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.ref\n\t\t\tFROM " . $TABLEAGENDA . " agenda, " . $TABLE_ITEM_PROPERTY . " ip\n\t\t\tWHERE agenda.id = ip.ref\n\t\t\tAND ip.tool='" . TOOL_CALENDAR_EVENT . "'\n\t\t\t{$visibility_condition}\n\t\t\tAND agenda.id='{$agenda_id}'";
    $result = Database::query($sql);
    $number_items = Database::num_rows($result);
    $myrow = Database::fetch_array($result, 'ASSOC');
    // there should be only one item so no need for a while loop
    $sql_rep = "SELECT * FROM {$TABLEAGENDA} WHERE id = {$agenda_id} AND parent_event_id IS NOT NULL AND parent_event_id !=0";
    $res_rep = Database::query($sql_rep);
    $repeat = false;
    $repeat_id = 0;
    if (Database::num_rows($res_rep) > 0) {
        $repeat = true;
        $row_rep = Database::fetch_array($res_rep);
        $repeat_id = $row_rep['parent_event_id'];
    }
    // DISPLAY: NO ITEMS
    if ($number_items == 0) {
        Display::display_warning_message(get_lang("NoAgendaItems"));
        return false;
    }
    // DISPLAY: THE ITEMS
    echo "<table id=\"data_table\" class=\"data_table\">";
    // DISPLAY : the icon, title, destinees of the item
    $myrow["start_date"] = api_get_local_time($myrow["start_date"]);
    // highlight: if a date in the small calendar is clicked we highlight the relevant items
    $db_date = (int) api_format_date($myrow["start_date"], "%d") . intval(api_format_date($myrow["start_date"], "%m")) . api_format_date($myrow["start_date"], "%Y");
    if ($_GET["day"] . $_GET["month"] . $_GET["year"] != $db_date) {
        if ($myrow['visibility'] == '0') {
            $style = "data_hidden";
            $stylenotbold = "datanotbold_hidden";
            $text_style = "text_hidden";
        } else {
            $style = "data";
            $stylenotbold = "datanotbold";
            $text_style = "text";
        }
    } else {
        $style = "datanow";
        $stylenotbold = "datanotboldnow";
        $text_style = "textnow";
    }
    echo Display::tag('h2', $myrow['title']);
    echo "<tr>";
    if (api_is_allowed_to_edit(false, true)) {
        if (!(api_is_course_coach() && !api_is_element_in_the_session(TOOL_AGENDA, $myrow['id']))) {
            // a coach can only delete an element belonging to his session
            // DISPLAY: edit delete button (course admin only)
            $export_icon = '../img/export.png';
            $export_icon_low = '../img/export_low_fade.png';
            $export_icon_high = '../img/export_high_fade.png';
            echo '<th style="text-align:right">';
            if (!$repeat && api_is_allowed_to_edit(false, true)) {
                // edit
                $mylink = api_get_self() . "?" . api_get_cidreq() . "&origin=" . Security::remove_XSS($_GET['origin']) . "&id=" . $myrow['id'];
                if (!empty($_GET['agenda_id'])) {
                    // rather ugly hack because the id parameter is already set above but below we set it again
                    $mylink .= '&agenda_id=' . Security::remove_XSS($_GET['agenda_id']) . '&id=' . Security::remove_XSS($_GET['agenda_id']);
                }
                if ($myrow['visibility'] == 1) {
                    $image_visibility = "visible";
                    $next_action = 0;
                } else {
                    $image_visibility = "invisible";
                    $next_action = 1;
                }
                echo '<a href="' . $mylink . '&action=showhide&next_action=' . $next_action . '">' . Display::return_icon($image_visibility . '.png', get_lang('Visible'), '', ICON_SIZE_SMALL) . '</a>';
                echo "<a href=\"" . $mylink . "&action=edit\">", Display::return_icon('edit.png', get_lang('ModifyCalendarItem'), '', ICON_SIZE_SMALL), "</a>", "<a href=\"" . $mylink . "&action=delete\" onclick=\"javascript:if(!confirm('" . addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES, $charset)) . "')) return false;\">", Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL), "</a>";
            }
            $mylink = 'ical_export.php?' . api_get_cidreq() . '&type=course&id=' . $myrow['id'];
            //echo '<a class="ical_export" href="'.$mylink.'&class=confidential" title="'.get_lang('ExportiCalConfidential').'">'.Display::return_icon($export_icon_high, get_lang('ExportiCalConfidential')).'</a> ';
            //echo '<a class="ical_export" href="'.$mylink.'&class=private" title="'.get_lang('ExportiCalPrivate').'">'.Display::return_icon($export_icon_low, get_lang('ExportiCalPrivate')).'</a> ';
            //echo '<a class="ical_export" href="'.$mylink.'&class=public" title="'.get_lang('ExportiCalPublic').'">'.Display::return_icon($export_icon, get_lang('ExportiCalPublic')).'</a> ';
            echo '<a href="javascript: void(0);" onclick="javascript:win_print=window.open(\'print.php?id=' . $myrow['id'] . '\',\'popup\',\'left=100,top=100,width=700,height=500,scrollbars=1,resizable=0\'); win_print.focus(); return false;">' . Display::return_icon('printer.png', get_lang('Print'), '', ICON_SIZE_SMALL) . '</a>&nbsp;';
            echo "</th>";
        }
    }
    // title
    echo "<tr class='row_odd'>";
    echo '<td colspan="2">' . get_lang("StartTime") . ": ";
    echo api_format_date($myrow['start_date']);
    echo "</td>";
    echo "</td>";
    echo "<tr class='row_odd'>";
    echo '<td colspan="2">' . get_lang("EndTime") . ": ";
//.........这里部分代码省略.........
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:101,代码来源:agenda.inc.php

示例15: display_agenda_items


//.........这里部分代码省略.........
            if ($myrow['visibility'] == '0') {
                $style = "data_hidden";
                $stylenotbold = "datanotbold_hidden";
                $text_style = "text_hidden";
            } else {
                $style = "data";
                $stylenotbold = "datanotbold";
                $text_style = "text";
            }
        } else {
            $style = "datanow";
            $stylenotbold = "datanotboldnow";
            $text_style = "textnow";
        }
        echo "<th>";
        // adding an internal anchor
        echo "<a name=\"" . (int) date("d", strtotime($myrow["start_date"])) . "\"></a>";
        // the icons. If the message is sent to one or more specific users/groups
        // we add the groups icon
        // 2do: if it is sent to groups we display the group icon, if it is sent to a user we show the user icon
        Display::display_icon('platform_event.png', get_lang('GlobalEvent'), '', ICON_SIZE_SMALL);
        /*if ($myrow['to_group_id']!=='0') {
         		echo Display::return_icon('group.gif', get_lang('AllUsersOfThePlatform'));
         	}*/
        echo " " . $myrow['title'] . "";
        echo "</th>";
        // the message has been sent to
        echo "<th>" . get_lang("SentTo") . ": " . get_lang('AllUsersOfThePlatform');
        //$sent_to=sent_to(TOOL_CALENDAR_EVENT, $myrow["ref"]);
        //$sent_to_form=sent_to_form($sent_to);
        //	echo $sent_to_form;
        echo "</th>";
        if (!$is_repeated && (api_is_allowed_to_edit(false, true) or api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous())) {
            if (!(api_is_course_coach() && !api_is_element_in_the_session(TOOL_AGENDA, $myrow['id']))) {
                // a coach can only delete an element belonging to his session
                echo '<th>' . get_lang('Actions');
                echo '</th></tr>';
            }
        }
        // display: the title
        echo "<tr class='row_odd'>";
        echo "<td>" . get_lang("StartTimeWindow") . ": ";
        echo api_format_date($myrow["start_date"], DATE_TIME_FORMAT_LONG);
        echo "</td>";
        echo "<td>";
        if ($myrow["end_date"] != "0000-00-00 00:00:00") {
            $myrow["end_date"] = api_get_local_time($myrow["end_date"]);
            echo get_lang("EndTimeWindow") . ": ";
            echo api_format_date($myrow["end_date"], DATE_TIME_FORMAT_LONG);
        }
        echo "</td>";
        if (!$is_repeated && (api_is_allowed_to_edit(false, true) or api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous())) {
            if (!(api_is_course_coach() && !api_is_element_in_the_session(TOOL_AGENDA, $myrow['id']))) {
                // a coach can only delete an element belonging to his session
                $mylink = api_get_self() . '?' . api_get_cidreq() . '&amp;origin=' . Security::remove_XSS($_GET['origin']) . '&amp;id=' . $myrow['id'];
                echo '<td align="center">';
                // edit
                echo '<a href="' . $mylink . '&amp;action=edit&amp;title="' . get_lang("ModifyCalendarItem") . '">';
                echo Display::return_icon('edit.gif', get_lang('ModifyCalendarItem')) . "</a>";
                echo "<a href=\"" . $mylink . "&amp;action=delete\" onclick=\"javascript:if(!confirm('" . addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES, $charset)) . "')) return false;\"  title=\"" . get_lang("Delete") . "\"> ";
                echo Display::return_icon('delete.gif', get_lang('Delete')) . "</a>";
            }
            if (!$is_repeated && (api_is_allowed_to_edit(false, true) or api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous())) {
                if (!(api_is_course_coach() && !api_is_element_in_the_session(TOOL_AGENDA, $myrow['id']))) {
                    // a coach can only delete an element belonging to his session
                    $td_colspan = '<td colspan="3">';
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:67,代码来源:calendar.lib.php


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