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


PHP api_is_platform_admin函数代码示例

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


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

示例1: create_backup_is_admin

function create_backup_is_admin($_cid)
{
    $this_section = SECTION_COURSES;
    if (isset($_GET['session']) && $_GET['session']) {
        $archive_path = api_get_path(SYS_ARCHIVE_PATH);
        $_cid = true;
        $is_courseAdmin = true;
    } else {
        $archive_path = api_get_path(SYS_ARCHIVE_PATH);
    }
    $archive_file = $_GET['archive'];
    $archive_file = str_replace(array('..', '/', '\\'), '', $archive_file);
    list($extension) = getextension($archive_file);
    if (empty($extension) || !file_exists($archive_path . $archive_file)) {
        return false;
    }
    $extension = strtolower($extension);
    $content_type = '';
    if (in_array($extension, array('xml', 'csv')) && (api_is_platform_admin(true) || api_is_drh())) {
        $content_type = 'application/force-download';
        // TODO: The following unclear condition is commented ant is to be checked. A replacement has been proposed.
        //} elseif (strtolower($extension) == 'zip' || ('html' && $_cid && (api_is_platform_admin(true) || $is_courseAdmin))) {
    } elseif ($extension == 'zip' && $_cid && (api_is_platform_admin(true) || $is_courseAdmin)) {
        //
        $content_type = 'application/force-download';
    }
    if (empty($content_type)) {
        return false;
    }
    return true;
}
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:31,代码来源:download.lib.php

示例2: storage_can_set

function storage_can_set($sv_user) {
	// platform admin can change any user's stored values, other users can only change their own values
	$allowed = ((api_is_platform_admin()) || ($sv_user == api_get_user_id()));
	if (!$allowed) {
		print "ERROR : Not allowed";
	}
	return $allowed;
}
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:8,代码来源:storageapi.php

示例3: classicAction

 /**
  * @param string $name
  * @param Request $request
  * @return Response
  */
 public function classicAction($name, Request $request)
 {
     // get.
     $_GET = $request->query->all();
     // post.
     $_POST = $request->request->all();
     $rootDir = $this->get('kernel')->getRealRootDir();
     //$_REQUEST = $request->request->all();
     $mainPath = $rootDir . 'main/';
     $fileToLoad = $mainPath . $name;
     // Setting legacy values inside the container
     /** @var Connection $dbConnection */
     $dbConnection = $this->container->get('database_connection');
     $em = $this->get('kernel')->getContainer()->get('doctrine.orm.entity_manager');
     $database = new \Database($dbConnection, array());
     $database->setConnection($dbConnection);
     $database->setManager($em);
     Container::$container = $this->container;
     Container::$dataDir = $this->container->get('kernel')->getDataDir();
     Container::$courseDir = $this->container->get('kernel')->getDataDir();
     //Container::$configDir = $this->container->get('kernel')->getConfigDir();
     $this->container->get('twig')->addGlobal('api_get_cidreq', api_get_cidreq());
     //$breadcrumb = $this->container->get('chamilo_core.block.breadcrumb');
     if (is_file($fileToLoad) && \Security::check_abs_path($fileToLoad, $mainPath)) {
         // Files inside /main need this variables to be set
         $is_allowed_in_course = api_is_allowed_in_course();
         $is_courseAdmin = api_is_course_admin();
         $is_platformAdmin = api_is_platform_admin();
         $toolNameFromFile = basename(dirname($fileToLoad));
         $charset = 'UTF-8';
         // Default values
         $_course = api_get_course_info();
         $_user = api_get_user_info();
         $debug = $this->container->get('kernel')->getEnvironment() == 'dev' ? true : false;
         // Loading file
         ob_start();
         require_once $fileToLoad;
         $out = ob_get_contents();
         ob_end_clean();
         // No browser cache when executing an exercise.
         if ($name == 'exercice/exercise_submit.php') {
             $responseHeaders = array('cache-control' => 'no-store, no-cache, must-revalidate');
         }
         $js = isset($htmlHeadXtra) ? $htmlHeadXtra : array();
         // $interbreadcrumb is loaded in the require_once file.
         $interbreadcrumb = isset($interbreadcrumb) ? $interbreadcrumb : null;
         $template = Container::$legacyTemplate;
         $defaultLayout = 'layout_one_col.html.twig';
         if (!empty($template)) {
             $defaultLayout = $template;
         }
         return $this->render('ChamiloCoreBundle::' . $defaultLayout, array('legacy_breadcrumb' => $interbreadcrumb, 'content' => $out, 'js' => $js));
     } else {
         // Found does not exist
         throw new NotFoundHttpException();
     }
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:62,代码来源:LegacyController.php

示例4: classicAction

 /**
  * Handles default Chamilo scripts handled by Display::display_header() and display_footer()
  *
  * @param \Silex\Application $app
  * @param string $file
  *
  * @return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response|void
  */
 public function classicAction(Application $app, $file)
 {
     $responseHeaders = array();
     /** @var Request $request */
     $request = $app['request'];
     // get.
     $_GET = $request->query->all();
     // post.
     $_POST = $request->request->all();
     // echo $request->getMethod();
     //$_REQUEST = $request->request->all();
     $mainPath = $app['paths']['sys_root'] . 'main/';
     $fileToLoad = $mainPath . $file;
     if (is_file($fileToLoad) && \Security::check_abs_path($fileToLoad, $mainPath)) {
         // Default values
         $_course = api_get_course_info();
         $_user = api_get_user_info();
         $charset = 'UTF-8';
         $debug = $app['debug'];
         $text_dir = api_get_text_direction();
         $is_platformAdmin = api_is_platform_admin();
         $_cid = api_get_course_id();
         // Loading file
         ob_start();
         require_once $mainPath . $file;
         $out = ob_get_contents();
         ob_end_clean();
         // No browser cache when executing an exercise.
         if ($file == 'exercice/exercise_submit.php') {
             $responseHeaders = array('cache-control' => 'no-store, no-cache, must-revalidate');
         }
         // Setting page header/footer conditions (important for LPs)
         $app['template']->setFooter($app['template.show_footer']);
         $app['template']->setHeader($app['template.show_header']);
         if (isset($htmlHeadXtra)) {
             $app['template']->addJsFiles($htmlHeadXtra);
         }
         if (isset($interbreadcrumb)) {
             $app['template']->setBreadcrumb($interbreadcrumb);
             $app['template']->loadBreadcrumbToTemplate();
         }
         if (isset($tpl)) {
             $response = $app['twig']->render($app['default_layout']);
         } else {
             $app['template']->assign('content', $out);
             $response = $app['twig']->render($app['default_layout']);
         }
     } else {
         return $app->abort(404, 'File not found');
     }
     return new Response($response, 200, $responseHeaders);
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:60,代码来源:LegacyController.php

示例5: indexAction

 /**
  *
  * @return string
  */
 public function indexAction(Application $app, $id)
 {
     $actions = null;
     if (api_is_platform_admin()) {
         $actions = '<a href="' . api_get_path(WEB_PATH) . 'main/admin/system_announcements.php">' . \Display::return_icon('edit.png', get_lang('EditSystemAnnouncement'), array(), 32) . '</a>';
     }
     if (api_is_anonymous()) {
         $visibility = \SystemAnnouncementManager::VISIBLE_GUEST;
     } else {
         $visibility = api_is_allowed_to_create_course() ? \SystemAnnouncementManager::VISIBLE_TEACHER : \SystemAnnouncementManager::VISIBLE_STUDENT;
     }
     $content = \SystemAnnouncementManager::display_announcements_slider($visibility, $id);
     $app['template']->assign('content', $content);
     $app['template']->assign('actions', $actions);
     $response = $app['template']->renderLayout('layout_1_col.tpl');
     return new Response($response, 200, array());
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:21,代码来源:NewsController.php

示例6: __construct

 /**
  * @inheritdoc
  */
 public function __construct($router, $toolbar = null, $config = array(), $prefix = null)
 {
     // Adding plugins depending of platform conditions
     $plugins = array();
     if (api_get_setting('document.show_glossary_in_documents') == 'ismanual') {
         $plugins[] = 'glossary';
     }
     if (api_get_setting('editor.youtube_for_students') == 'true') {
         $plugins[] = 'youtube';
     } else {
         if (api_is_allowed_to_edit() || api_is_platform_admin()) {
             $plugins[] = 'youtube';
         }
     }
     if (api_get_setting('editor.enabled_googlemaps') == 'true') {
         $plugins[] = 'leaflet';
     }
     if (api_get_setting('editor.math_asciimathML') == 'true') {
         $plugins[] = 'asciimath';
     }
     if (api_get_setting('editor.enabled_mathjax') == 'true') {
         $plugins[] = 'mathjax';
         $config['mathJaxLib'] = api_get_path(WEB_PATH) . 'web/assets/MathJax/MathJax.js?config=AM_HTMLorMML';
     }
     if (api_get_setting('editor.enabled_asciisvg') == 'true') {
         $plugins[] = 'asciisvg';
     }
     if (api_get_setting('editor.enabled_wiris') == 'true') {
         // Commercial plugin
         $plugins[] = 'ckeditor_wiris';
     }
     if (api_get_setting('editor.enabled_imgmap') == 'true') {
         $plugins[] = 'mapping';
     }
     /*if (api_get_setting('block_copy_paste_for_students') == 'true') {
           // Missing
       }*/
     if (api_get_setting('editor.more_buttons_maximized_mode') == 'true') {
         $plugins[] = 'toolbarswitch';
     }
     if (api_get_setting('editor.allow_spellcheck') == 'true') {
         $plugins[] = 'scayt';
     }
     $this->defaultPlugins = array_merge($this->defaultPlugins, $plugins);
     parent::__construct($router, $toolbar, $config, $prefix);
 }
开发者ID:daffef,项目名称:chamilo-lms,代码行数:49,代码来源:Basic.php

示例7: get_course_data

/**
 * Get course data to display
 * @param int $from
 * @param int $number_of_items
 * @param int $column
 * @param string $direction
 *
 * @return array
 */
function get_course_data($from, $number_of_items, $column, $direction)
{
    $course_table = Database::get_main_table(TABLE_MAIN_COURSE);
    $sql = "SELECT  code AS col0,\n                    title AS col1,\n                    code AS col2,\n                    course_language AS col3,\n                    category_code AS col4,\n                    subscribe AS col5,\n                    unsubscribe AS col6,\n                    code AS col7,\n                    visibility AS col8,\n                    directory as col9,\n                    visual_code\n    \t\tFROM {$course_table}";
    if ((api_is_platform_admin() || api_is_session_admin()) && api_is_multiple_url_enabled() && api_get_current_access_url_id() != -1) {
        $access_url_rel_course_table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
        $sql .= " INNER JOIN {$access_url_rel_course_table} url_rel_course ON (id = url_rel_course.c_id)";
    }
    if (isset($_GET['keyword'])) {
        $keyword = Database::escape_string("%" . trim($_GET['keyword']) . "%");
        $sql .= " WHERE (\n            title LIKE '" . $keyword . "' OR\n            code LIKE '" . $keyword . "' OR\n            visual_code LIKE '" . $keyword . "'\n        )\n        ";
    } elseif (isset($_GET['keyword_code'])) {
        $keyword_code = Database::escape_string("%" . $_GET['keyword_code'] . "%");
        $keyword_title = Database::escape_string("%" . $_GET['keyword_title'] . "%");
        $keyword_category = Database::escape_string("%" . $_GET['keyword_category'] . "%");
        $keyword_language = Database::escape_string("%" . $_GET['keyword_language'] . "%");
        $keyword_visibility = Database::escape_string("%" . $_GET['keyword_visibility'] . "%");
        $keyword_subscribe = Database::escape_string($_GET['keyword_subscribe']);
        $keyword_unsubscribe = Database::escape_string($_GET['keyword_unsubscribe']);
        $sql .= " WHERE\n                (code LIKE '" . $keyword_code . "' OR visual_code LIKE '" . $keyword_code . "') AND\n                title LIKE '" . $keyword_title . "' AND\n                category_code LIKE '" . $keyword_category . "' AND\n                course_language LIKE '" . $keyword_language . "' AND\n                visibility LIKE '" . $keyword_visibility . "' AND\n                subscribe LIKE '" . $keyword_subscribe . "' AND\n                unsubscribe LIKE '" . $keyword_unsubscribe . "'";
    }
    // Adding the filter to see the user's only of the current access_url.
    if ((api_is_platform_admin() || api_is_session_admin()) && api_is_multiple_url_enabled() && api_get_current_access_url_id() != -1) {
        $sql .= " AND url_rel_course.access_url_id=" . api_get_current_access_url_id();
    }
    $sql .= " ORDER BY col{$column} {$direction} ";
    $sql .= " LIMIT {$from}, {$number_of_items}";
    $res = Database::query($sql);
    $courses = array();
    $languages = api_get_languages_to_array();
    while ($course = Database::fetch_array($res)) {
        // Place colour icons in front of courses.
        $show_visual_code = $course['visual_code'] != $course[2] ? Display::label($course['visual_code'], 'info') : null;
        $course[1] = get_course_visibility_icon($course[8]) . '<a href="' . api_get_path(WEB_COURSE_PATH) . $course[9] . '/index.php">' . $course[1] . '</a> ' . $show_visual_code;
        $course[5] = $course[5] == SUBSCRIBE_ALLOWED ? get_lang('Yes') : get_lang('No');
        $course[6] = $course[6] == UNSUBSCRIBE_ALLOWED ? get_lang('Yes') : get_lang('No');
        $language = isset($languages[$course[3]]) ? $languages[$course[3]] : $course[3];
        $course_rem = array($course[0], $course[1], $course[2], $language, $course[4], $course[5], $course[6], $course[7]);
        $courses[] = $course_rem;
    }
    return $courses;
}
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:51,代码来源:course_list.php

示例8: is_group_member

 /**
  * @param int $group_id
  * @param int $user_id
  * @return bool
  */
 public function is_group_member($group_id, $user_id = 0)
 {
     if (api_is_platform_admin()) {
         return true;
     }
     if (empty($user_id)) {
         $user_id = api_get_user_id();
     }
     $roles = array(GROUP_USER_PERMISSION_ADMIN, GROUP_USER_PERMISSION_MODERATOR, GROUP_USER_PERMISSION_READER, GROUP_USER_PERMISSION_HRM);
     $user_role = self::get_user_group_role($user_id, $group_id);
     if (in_array($user_role, $roles)) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:daffef,项目名称:chamilo-lms,代码行数:21,代码来源:usergroup.lib.php

示例9: isset

$from = isset($_GET['from']) ? $_GET['from'] : null;

// Starting the output buffering when we are exporting the information.
$export_csv = isset($_GET['export']) && $_GET['export'] == 'csv' ? true : false;
$session_id = intval($_REQUEST['id_session']);

if ($from == 'myspace') {
    $from_myspace = true;
    $this_section = "session_my_space";
} else {
    $this_section = SECTION_COURSES;
}

// Access restrictions.
$is_allowedToTrack =
    api_is_platform_admin() ||
    api_is_allowed_to_create_course() ||
    api_is_session_admin() ||
    api_is_drh() ||
    api_is_course_tutor() ||
    api_is_course_admin();

if (!$is_allowedToTrack) {
    api_not_allowed(true);
    exit;
}

// If the user is a HR director (drh)
if (api_is_drh()) {
    // Blocking course for drh
    if (api_drh_can_access_all_session_content()) {
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:31,代码来源:courseLog.php

示例10: api_get_path

 * @author Isaac Flores Paz <florespaz_isaac@hotmail.com>
 * @todo use Display::panel()
 * @package chamilo.social
 */
$cidReset = true;
require_once '../inc/global.inc.php';
// Include OpenGraph NOT AVAILABLE
require_once api_get_path(LIBRARY_PATH) . 'opengraph/OpenGraph.php';
if (api_get_setting('allow_social_tool') != 'true') {
    $url = api_get_path(WEB_PATH) . 'whoisonline.php?id=' . intval($_GET['u']);
    header('Location: ' . $url);
    exit;
}
$user_id = api_get_user_id();
$friendId = isset($_GET['u']) ? intval($_GET['u']) : api_get_user_id();
$isAdmin = api_is_platform_admin($user_id);
$userGroup = new UserGroup();
$show_full_profile = true;
//social tab
$this_section = SECTION_SOCIAL;
//Initialize blocks
$social_extra_info_block = null;
$social_course_block = null;
$social_group_info_block = null;
$social_rss_block = null;
$social_session_block = null;
if (!empty($_POST['social_wall_new_msg_main']) || !empty($_FILES['picture']['tmp_name'])) {
    $messageId = 0;
    $messageContent = $_POST['social_wall_new_msg_main'];
    if (!empty($_POST['url_content'])) {
        $messageContent = $_POST['social_wall_new_msg_main'] . '<br><br>' . $_POST['url_content'];
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:profile.php

示例11: removeCategory

 /**
  * Removes the category with id=in_id from the database if no question use this category
  * @todo I'm removing the $in_id parameter because it seems that you're using $this->id instead of $in_id after confirmation delete this
  * jmontoya
  */
 public function removeCategory()
 {
     $category = Database::getManager()->find('Chamilo\\CoreBundle\\CQuizCategory', $this->id);
     if (!$category) {
         return false;
     }
     //Only admins can delete global categories
     $courseId = $category->getCId();
     //Only admins can delete global categories
     if (empty($courseId) && !api_is_platform_admin() || api_is_question_manager()) {
         return false;
     }
     $repo = Database::getManager()->getRepository('ChamiloCoreBundle:CQuizCategory');
     $repo->removeFromTree($category);
     // clear cached nodes
     Database::getManager()->clear();
     return true;
 }
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:23,代码来源:testcategory.class.php

示例12: set_footer_parameters

    /**
     * Set footer parameters
     */
    private function set_footer_parameters()
    {
        global $_configuration;

        //Show admin data
        //$this->assign('show_administrator_data', api_get_setting('show_administrator_data'));

        if (api_get_setting('show_administrator_data') == 'true') {
            //Administrator name
            $administrator_data = get_lang('Manager').' : '.Display::encrypted_mailto_link(
                    api_get_setting('emailAdministrator'),
                    api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'))
                );
            $this->assign('administrator_name', $administrator_data);
        }

        //Loading footer extra content
        if (!api_is_platform_admin()) {
            $extra_footer = trim(api_get_setting('footer_extra_content'));
            if (!empty($extra_footer)) {
                $this->assign('footer_extra_content', $extra_footer);
            }
        }

        //Tutor name
        if (api_get_setting('show_tutor_data') == 'true') {
            // Course manager
            $id_course  = api_get_course_id();
            $id_session = api_get_session_id();
            if (isset($id_course) && $id_course != -1) {
                $tutor_data = '';
                if ($id_session != 0) {
                    $coachs_email = CourseManager::get_email_of_tutor_to_session($id_session, $id_course);
                    $email_link   = array();
                    foreach ($coachs_email as $coach) {
                        $email_link[] = Display::encrypted_mailto_link($coach['email'], $coach['complete_name']);
                    }
                    if (count($coachs_email) > 1) {
                        $tutor_data .= get_lang('Coachs').' : ';
                        $tutor_data .= array_to_string($email_link, CourseManager::USER_SEPARATOR);
                    } elseif (count($coachs_email) == 1) {
                        $tutor_data .= get_lang('Coach').' : ';
                        $tutor_data .= array_to_string($email_link, CourseManager::USER_SEPARATOR);
                    } elseif (count($coachs_email) == 0) {
                        $tutor_data .= '';
                    }
                }
                $this->assign('session_teachers', $tutor_data);
            }
        }

        if (api_get_setting('show_teacher_data') == 'true') {
            // course manager
            $id_course = api_get_course_id();
            if (isset($id_course) && $id_course != -1) {
                $teacher_data = '';
                $mail         = CourseManager::get_emails_of_tutors_to_course($id_course);
                if (!empty($mail)) {
                    $teachers_parsed = array();
                    foreach ($mail as $value) {
                        foreach ($value as $email => $name) {
                            $teachers_parsed[] = Display::encrypted_mailto_link($email, $name);
                        }
                    }
                    $label = get_lang('Teacher');
                    if (count($mail) > 1) {
                        $label = get_lang('Teachers');
                    }
                    $teacher_data .= $label.' : '.array_to_string($teachers_parsed, CourseManager::USER_SEPARATOR);
                }
                $this->assign('teachers', $teacher_data);
            }
        }
        /* $stats = '';
          $this->assign('execution_stats', $stats); */
    }
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:79,代码来源:template.lib.php

示例13: modify_filter

/**
 * Build the modify-column of the table
 * @param int $user_id The user id
 * @return string Some HTML-code
 */
function modify_filter($user_id, $row, $data)
{
    global $is_allowed_to_track, $charset;
    $user_id = $data[0];
    $course_info = $_course = api_get_course_info();
    $current_user_id = api_get_user_id();
    $sessionId = api_get_session_id();
    $type = isset($_REQUEST['type']) ? intval($_REQUEST['type']) : STUDENT;
    $result = "";
    if ($is_allowed_to_track) {
        $result .= '<a href="../mySpace/myStudents.php?' . api_get_cidreq() . '&student=' . $user_id . '&details=true&course=' . $_course['id'] . '&origin=user_course&id_session=' . api_get_session_id() . '" title="' . get_lang('Tracking') . '"  >
            <img border="0" alt="' . get_lang('Tracking') . '" src="../img/icons/22/stats.png" />
        </a>';
    }
    // If platform admin, show the login_as icon (this drastically shortens
    // time taken by support to test things out)
    if (api_is_platform_admin()) {
        $result .= ' <a href="' . api_get_path(WEB_CODE_PATH) . 'admin/user_list.php?action=login_as&user_id=' . $user_id . '&sec_token=' . $_SESSION['sec_token'] . '">' . Display::return_icon('login_as.gif', get_lang('LoginAs')) . '</a>&nbsp;&nbsp;';
    }
    if (api_is_allowed_to_edit(null, true)) {
        if (empty($sessionId)) {
            $isTutor = isset($data['is_tutor']) ? intval($data['is_tutor']) : 0;
            $isTutor = empty($isTutor) ? 1 : 0;
            $text = get_lang('RemoveTutorStatus');
            if ($isTutor) {
                $text = get_lang('SetTutor');
            }
            $disabled = '';
            if ($data['user_status_in_course'] == STUDENT) {
                $result .= Display::url($text, 'user.php?' . api_get_cidreq() . '&action=set_tutor&is_tutor=' . $isTutor . '&user_id=' . $user_id . '&type=' . $type, array('class' => 'btn btn-default ' . $disabled)) . '&nbsp;';
            }
        }
        // edit
        if (api_get_setting('allow_user_course_subscription_by_course_admin') == 'true' or api_is_platform_admin()) {
            // unregister
            if ($user_id != $current_user_id || api_is_platform_admin()) {
                $result .= '<a class="btn btn-small btn-danger" href="' . api_get_self() . '?' . api_get_cidreq() . '&type=' . $type . '&unregister=yes&user_id=' . $user_id . '" title="' . get_lang('Unreg') . ' " onclick="javascript:if(!confirm(\'' . addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, $charset)) . '\')) return false;">' . get_lang('Unreg') . '</a>&nbsp;';
            } else {
                //$result .= Display::return_icon('unsubscribe_course_na.png', get_lang('Unreg'),'',ICON_SIZE_SMALL).'</a>&nbsp;';
            }
        }
    } else {
        // Show buttons for unsubscribe
        if ($course_info['unsubscribe'] == 1) {
            if ($user_id == $current_user_id) {
                $result .= '<a class="btn btn-small btn-danger" href="' . api_get_self() . '?' . api_get_cidreq() . '&type=' . $type . '&unregister=yes&user_id=' . $user_id . '" title="' . get_lang('Unreg') . ' " onclick="javascript:if(!confirm(\'' . addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, $charset)) . '\')) return false;">' . get_lang('Unreg') . '</a>&nbsp;';
            }
        }
    }
    return $result;
}
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:56,代码来源:user.php

示例14: api_not_allowed

//todo @this validation could be in a function in group_portal_manager
if (empty($group_id)) {
    api_not_allowed(true);
} else {
    $group_info = $usergroup->get($group_id);
    if (empty($group_info)) {
        api_not_allowed(true);
    }
    $is_member = $usergroup->is_group_member($group_id);
    if ($group_info['visibility'] == GROUP_PERMISSION_CLOSED && !$is_member) {
        api_not_allowed(true);
    }
}
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete') {
    $group_role = $usergroup->get_user_group_role(api_get_user_id(), $group_id);
    if (api_is_platform_admin() || in_array($group_role, array(GROUP_USER_PERMISSION_ADMIN, GROUP_USER_PERMISSION_MODERATOR))) {
        $usergroup->delete_topic($group_id, $topic_id);
        Display::addFlash(DIsplay::return_message(get_lang('Deleted')));
        header("Location: group_view.php?id={$group_id}");
        exit;
    }
}
$content = null;
$social_right_content = '';
if (isset($_POST['action'])) {
    $title = isset($_POST['title']) ? $_POST['title'] : null;
    $content = $_POST['content'];
    $group_id = intval($_POST['group_id']);
    $parent_id = intval($_POST['parent_id']);
    if ($_POST['action'] == 'reply_message_group') {
        $title = cut($content, 50);
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:group_topics.php

示例15: userHasAccessToBrowse

 /**
  * @param int $userId
  * @param array $groupInfo
  * @param int $sessionId
  *
  * @return bool
  */
 public static function userHasAccessToBrowse($userId, $groupInfo, $sessionId = 0)
 {
     if (empty($groupInfo)) {
         return false;
     }
     if (api_is_platform_admin()) {
         return true;
     }
     if (api_is_allowed_to_edit(false, true)) {
         return true;
     }
     $groupId = $groupInfo['id'];
     $tutors = self::get_subscribed_tutors($groupId, true);
     if (in_array($userId, $tutors)) {
         return true;
     }
     if ($groupInfo['status'] == 0) {
         return false;
     }
     if (self::user_has_access($userId, $groupId, self::GROUP_TOOL_FORUM) || self::user_has_access($userId, $groupId, self::GROUP_TOOL_DOCUMENTS) || self::user_has_access($userId, $groupId, self::GROUP_TOOL_CALENDAR) || self::user_has_access($userId, $groupId, self::GROUP_TOOL_ANNOUNCEMENT) || self::user_has_access($userId, $groupId, self::GROUP_TOOL_WORK) || self::user_has_access($userId, $groupId, self::GROUP_TOOL_WIKI) || self::user_has_access($userId, $groupId, self::GROUP_TOOL_CHAT)) {
         return true;
     }
     if (api_is_course_coach() && $groupInfo['session_id'] == $sessionId) {
         return true;
     }
     return false;
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:34,代码来源:groupmanager.lib.php


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