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


PHP api_get_user_id函数代码示例

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


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

示例1: __construct

 /**
  * Constructor
  * @param int $certificate_id ID of the certificate.
  *
  * If no ID given, take user_id and try to generate one
  */
 public function __construct($certificate_id = null)
 {
     $this->table = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE);
     $this->certificate_data = null;
     if (isset($certificate_id)) {
         $this->certificate_data = $this->get($certificate_id);
         $this->user_id = $this->certificate_data['user_id'];
     } else {
         //Try with the current user
         $this->user_id = api_get_user_id();
     }
     if ($this->user_id) {
         // Need to be called before any operation
         $this->check_certificate_path();
         // To force certification generation
         if ($this->force_certificate_generation) {
             $this->generate();
         }
         if (isset($this->certificate_data) && $this->certificate_data) {
             if (empty($this->certificate_data['path_certificate'])) {
                 $this->generate();
             }
         }
     }
     //Setting the qr and html variables
     if (isset($certificate_id) && !empty($this->certification_user_path)) {
         $pathinfo = pathinfo($this->certificate_data['path_certificate']);
         $this->html_file = $this->certification_user_path . basename($this->certificate_data['path_certificate']);
         $this->qr_file = $this->certification_user_path . $pathinfo['filename'] . '_qr.png';
     }
 }
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:37,代码来源:certificate.lib.php

示例2: setup

 /**
  * Setups the folder
  */
 public function setup()
 {
     $userId = api_get_user_id();
     $userInfo = api_get_user_info();
     $sessionId = api_get_session_id();
     $courseInfo = $this->connector->course;
     if (!empty($courseInfo)) {
         $coursePath = api_get_path(SYS_COURSE_PATH);
         $courseDir = $courseInfo['directory'] . '/document';
         $baseDir = $coursePath . $courseDir;
         // Creates shared folder
         if (!file_exists($baseDir . '/shared_folder')) {
             $title = get_lang('UserFolders');
             $folderName = '/shared_folder';
             //$groupId = 0;
             $visibility = 0;
             create_unexisting_directory($courseInfo, $userId, $sessionId, 0, null, $baseDir, $folderName, $title, $visibility);
         }
         // Creates user-course folder
         if (!file_exists($baseDir . '/shared_folder/sf_user_' . $userId)) {
             $title = $userInfo['complete_name'];
             $folderName = '/shared_folder/sf_user_' . $userId;
             $visibility = 1;
             create_unexisting_directory($courseInfo, $userId, $sessionId, 0, null, $baseDir, $folderName, $title, $visibility);
         }
     }
 }
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:30,代码来源:CourseDriver.php

示例3: 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

示例4: update

 /**
  * Updates an URL access
  * @author Julio Montoya <gugli100@gmail.com>,
  *
  * @param	int 	$url_id The url id
  * @param	string 	$url
  * @param	string  $description The description of the site
  * @param	int		$active is active or not
  * @return 	boolean if success
  */
 public static function update($url_id, $url, $description, $active)
 {
     $url_id = intval($url_id);
     $table = Database::get_main_table(TABLE_MAIN_ACCESS_URL);
     $sql = "UPDATE {$table}\n                SET url \t= '" . Database::escape_string($url) . "',\n                description = '" . Database::escape_string($description) . "',\n                active \t\t= '" . intval($active) . "',\n                created_by \t= '" . api_get_user_id() . "',\n                tms \t\t= '" . api_get_utc_datetime() . "'\n                WHERE id = '{$url_id}'";
     $result = Database::query($sql);
     return $result;
 }
开发者ID:daffef,项目名称:chamilo-lms,代码行数:18,代码来源:urlmanager.lib.php

示例5: update

 /**
  * Updates an URL access to Dokeos
  * @author Julio Montoya <gugli100@gmail.com>,
  *
  * @param    int    The url id
  * @param    string  The description of the site
  * @param    int        is active or not
  * @param    int     the user_id of the owner
  * @param    int    The URL type
  * @param    array    Extra parameters for type > 1
  * @return    boolean if success
  */
 public static function update($url_id, $url, $description, $active, $type, $extra_params)
 {
     $url_id = intval($url_id);
     $table_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL);
     $tms = time();
     $sql = "UPDATE {$table_access_url}\n                SET url \t= '" . Database::escape_string($url) . "',\n                description = '" . Database::escape_string($description) . "',\n                active \t\t= '" . Database::escape_string($active) . "',\n                created_by \t= '" . api_get_user_id() . "',\n                tms \t\t= FROM_UNIXTIME(" . $tms . ")\n                WHERE id = '{$url_id}'";
     $result = Database::query($sql);
     return $result;
 }
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:21,代码来源:urlmanager.lib.php

示例6: indexAction

 /**
  * @param Application $app
  * @param string $type courses|sessions|mycoursecategories
  * @param string $filter for the userportal courses page. Only works when setting 'history'
  * @param int $page
  *
  * @return Response|void
  */
 public function indexAction(Application $app, $type = 'courses', $filter = 'current', $page = 1)
 {
     // @todo Use filters like "after/before|finish" to manage user access
     api_block_anonymous_users();
     // Abort request because the user is not allowed here - @todo use filters
     if ($app['allowed'] == false) {
         return $app->abort(403, 'Not allowed');
     }
     // Main courses and session list
     $items = null;
     $type = str_replace('/', '', $type);
     /** @var \PageController $pageController */
     $pageController = $app['page_controller'];
     switch ($type) {
         case 'sessions':
             $items = $pageController->returnSessions(api_get_user_id(), $filter, $page);
             break;
         case 'sessioncategories':
             $items = $pageController->returnSessionsCategories(api_get_user_id(), $filter, $page);
             break;
         case 'courses':
             $items = $pageController->returnCourses(api_get_user_id(), $filter, $page);
             break;
         case 'mycoursecategories':
             $items = $pageController->returnMyCourseCategories(api_get_user_id(), $filter, $page);
             break;
         case 'specialcourses':
             $items = $pageController->returnSpecialCourses(api_get_user_id(), $filter, $page);
             break;
     }
     //Show the chamilo mascot
     if (empty($items) && empty($filter)) {
         $pageController->return_welcome_to_course_block($app['template']);
     }
     /*
             $app['my_main_menu'] = function($app) {
                 $menu = $app['knp_menu.factory']->createItem('root');
                 $menu->addChild('Home', array('route' => api_get_path(WEB_CODE_PATH)));
                 return $menu;
             };
             $app['knp_menu.menus'] = array('main' => 'my_main_menu');*/
     $app['template']->assign('content', $items);
     $pageController->setCourseSessionMenu();
     $pageController->setProfileBlock();
     $pageController->setUserImageBlock();
     $pageController->setCourseBlock($filter);
     $pageController->setSessionBlock();
     $pageController->return_reservation_block();
     $pageController->returnNavigationLinks($app['template']->getNavigationLinks());
     $app['template']->assign('search_block', $pageController->return_search_block());
     $app['template']->assign('classes_block', $pageController->return_classes_block());
     $pageController->returnSkillsLinks();
     // Deleting the session_id.
     Session::erase('session_id');
     $response = $app['template']->render_template('userportal/index.tpl');
     return new Response($response, 200, array());
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:65,代码来源:UserPortalController.php

示例7: aiccItem

 /**
  * Class constructor. Depending of the type of construction called ('db' or 'manifest'), will create a scormItem
  * object from database records or from the array given as second parameter
  * @param	string	Type of construction needed ('db' or 'config', default = 'config')
  * @param	mixed	Depending on the type given, DB id for the lp_item or parameters array
  */
 function aiccItem($type = 'config', $params)
 {
     if (isset($params)) {
         switch ($type) {
             case 'db':
                 parent::learnpathItem($params, api_get_user_id());
                 $this->aicc_contact = false;
                 //TODO implement this way of metadata object creation
                 return false;
             case 'config':
                 //do the same as the default
             //do the same as the default
             default:
                 //if($first_item->type == XML_ELEMENT_NODE) this is already check prior to the call to this function
                 foreach ($params as $a => $value) {
                     switch ($a) {
                         case 'system_id':
                             $this->identifier = Database::escape_string(strtolower($value));
                             break;
                         case 'type':
                             $this->au_type = Database::escape_string($value);
                             break;
                         case 'command_line':
                             $this->command_line = Database::escape_string($value);
                             break;
                         case 'max_time_allowed':
                             $this->maxtimeallowed = Database::escape_string($value);
                             break;
                         case 'time_limit_action':
                             $this->timelimitaction = Database::escape_string($value);
                             break;
                         case 'max_score':
                             $this->max_score = Database::escape_string($value);
                             break;
                         case 'core_vendor':
                             $this->core_vendor = Database::escape_string($value);
                             break;
                         case 'system_vendor':
                             $this->system_vendor = Database::escape_string($value);
                             break;
                         case 'file_name':
                             $this->path = Database::escape_string($value);
                             break;
                         case 'mastery_score':
                             $this->masteryscore = Database::escape_string($value);
                             break;
                         case 'web_launch':
                             $this->parameters = Database::escape_string($value);
                             break;
                     }
                 }
                 return true;
         }
     }
     return false;
 }
开发者ID:Eidn,项目名称:shanghai,代码行数:62,代码来源:aiccItem.class.php

示例8: heartbeat

 /**
  * Refreshes the chat windows (usually called every x seconds through AJAX)
  * @return void (prints JSON array of chat windows)
  */
 public function heartbeat()
 {
     $to_user_id = api_get_user_id();
     $minutes = 60;
     $now = time() - $minutes * 60;
     $now = api_get_utc_datetime($now);
     //OR  sent > '$now'
     $sql = "SELECT * FROM " . $this->table . "\n                WHERE to_user = '" . intval($to_user_id) . "' AND ( recd  = 0 ) ORDER BY id ASC";
     $result = Database::query($sql);
     $chat_list = array();
     while ($chat = Database::fetch_array($result, 'ASSOC')) {
         $chat_list[$chat['from_user']]['items'][] = $chat;
     }
     $items = array();
     foreach ($chat_list as $from_user_id => $rows) {
         $rows = $rows['items'];
         $user_info = api_get_user_info($from_user_id, true);
         //Cleaning tsChatBoxes
         unset($_SESSION['tsChatBoxes'][$from_user_id]);
         foreach ($rows as $chat) {
             $chat['message'] = Security::remove_XSS($chat['message']);
             $item = array('s' => '0', 'f' => $from_user_id, 'm' => $chat['message'], 'username' => $user_info['complete_name'], 'id' => $chat['id']);
             $items[$from_user_id]['items'][] = $item;
             $items[$from_user_id]['user_info']['user_name'] = $user_info['complete_name'];
             $items[$from_user_id]['user_info']['online'] = $user_info['user_is_online'];
             $_SESSION['openChatBoxes'][$from_user_id] = api_strtotime($chat['sent'], 'UTC');
         }
         $_SESSION['chatHistory'][$from_user_id]['items'][] = $item;
         $_SESSION['chatHistory'][$from_user_id]['user_info']['user_name'] = $user_info['complete_name'];
         $_SESSION['chatHistory'][$from_user_id]['user_info']['online'] = $user_info['user_is_online'];
     }
     if (!empty($_SESSION['openChatBoxes'])) {
         foreach ($_SESSION['openChatBoxes'] as $user_id => $time) {
             if (!isset($_SESSION['tsChatBoxes'][$user_id])) {
                 $now = time() - $time;
                 $time = api_convert_and_format_date($time, DATE_TIME_FORMAT_SHORT_TIME_FIRST);
                 $message = sprintf(get_lang('SentAtX'), $time);
                 if ($now > 180) {
                     $item = array('s' => '2', 'f' => $user_id, 'm' => $message);
                     if (isset($_SESSION['chatHistory'][$user_id])) {
                         $_SESSION['chatHistory'][$user_id]['items'][] = $item;
                     }
                     $_SESSION['tsChatBoxes'][$user_id] = 1;
                 }
             }
         }
     }
     //print_r($_SESSION['chatHistory']);
     $sql = "UPDATE " . $this->table . " SET recd = 1 WHERE to_user = '" . $to_user_id . "' AND recd = 0";
     Database::query($sql);
     if ($items != '') {
         //$items = substr($items, 0, -1);
     }
     echo json_encode(array('items' => $items));
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:59,代码来源:chat.lib.php

示例9: displayForm

/**
 * Show the form to copy courses
 * @global string $returnLink
 * @global string $courseCode
 */
function displayForm()
{
    global $returnLink, $courseCode;
    $courseInfo = api_get_course_info();
    $sessionId = api_get_session_id();
    $userId = api_get_user_id();
    $sessions = SessionManager::getSessionsCoachedByUser($userId);
    $html = '';
    // Actions
    $html .= '<div class="actions">';
    // Link back to the documents overview
    $html .= '<a href="' . $returnLink . '">' . Display::return_icon('back.png', get_lang('BackTo') . ' ' . get_lang('Maintenance'), '', ICON_SIZE_MEDIUM) . '</a>';
    $html .= '</div>';
    $html .= Display::return_message(get_lang('CopyCourseFromSessionToSessionExplanation'));
    $html .= '<form name="formulaire" method="post" action="' . api_get_self() . '?' . api_get_cidreq() . '" >';
    $html .= '<table border="0" cellpadding="5" cellspacing="0" width="100%">';
    // Source
    $html .= '<tr><td width="15%"><b>' . get_lang('OriginCoursesFromSession') . ':</b></td>';
    $html .= '<td width="10%" align="left">' . api_get_session_name($sessionId) . '</td>';
    $html .= '<td width="50%">';
    $html .= "{$courseInfo['title']} ({$courseInfo['code']})" . '</td></tr>';
    // Destination
    $html .= '<tr><td width="15%"><b>' . get_lang('DestinationCoursesFromSession') . ':</b></td>';
    $html .= '<td width="10%" align="left"><div id="ajax_sessions_list_destination">';
    $html .= '<select name="sessions_list_destination" onchange="javascript: xajax_searchCourses(this.value,\'destination\');">';
    if (empty($sessions)) {
        $html .= '<option value = "0">' . get_lang('ThereIsNotStillASession') . '</option>';
    } else {
        $html .= '<option value = "0">' . get_lang('SelectASession') . '</option>';
        foreach ($sessions as $session) {
            if ($session['id'] == $sessionId) {
                continue;
            }
            if (!SessionManager::sessionHasCourse($session['id'], $courseCode)) {
                continue;
            }
            $html .= '<option value="' . $session['id'] . '">' . $session['name'] . '</option>';
        }
    }
    $html .= '</select ></div></td>';
    $html .= '<td width="50%">';
    $html .= '<div id="ajax_list_courses_destination">';
    $html .= '<select id="destination" name="SessionCoursesListDestination[]" style="width:380px;" ></select></div></td>';
    $html .= '</tr></table>';
    $html .= "<fieldset>";
    $html .= '<legend>' . get_lang('TypeOfCopy') . ' <small>(' . get_lang('CopyOnlySessionItems') . ')</small></legend>';
    $html .= '<label class="radio"><input type="radio" id="copy_option_1" name="copy_option" value="full_copy" checked="checked"/>';
    $html .= get_lang('FullCopy') . '</label>';
    $html .= '<label class="radio"><input type="radio" id="copy_option_2" name="copy_option" value="select_items"/>';
    $html .= ' ' . get_lang('LetMeSelectItems') . '</label><br/>';
    $html .= "</fieldset>";
    $html .= '<button class="save" type="submit" onclick="javascript:if(!confirm(' . "'" . addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES)) . "'" . ')) return false;">' . get_lang('CopyCourse') . '</button>';
    $html .= '</form>';
    echo $html;
}
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:60,代码来源:copy_course_session_selected.php

示例10: getConfiguration

 /**
  * {@inheritdoc}
  */
 public function getConfiguration()
 {
     if (!empty($this->connector->course)) {
         $userId = api_get_user_id();
         $path = 'shared_folder/sf_user_' . $userId;
         $alias = $this->connector->course['code'] . ' ' . get_lang('CourseUserDocument');
         if (!empty($userId)) {
             return array('driver' => 'CourseUserDriver', 'alias' => $alias, 'path' => $this->getCourseDocumentSysPath() . $path, 'URL' => $this->getCourseDocumentRelativeWebPath() . $path, 'accessControl' => 'access');
         }
     }
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:14,代码来源:CourseUserDriver.php

示例11: save

 /**
  * Organize the saving of a link, using the parent's save method and
  * updating the item_property table
  * @param array $params
  * @param boolean $show_query Whether to show the query in logs when
  * calling parent's save method
  *
  * @return bool True if link could be saved, false otherwise
  */
 public function save($params, $show_query = null)
 {
     $course_info = api_get_course_info();
     $params['session_id'] = api_get_session_id();
     $params['category_id'] = isset($params['category_id']) ? $params['category_id'] : 0;
     $id = parent::save($params, $show_query);
     if (!empty($id)) {
         api_item_property_update($course_info, TOOL_LINK, $id, 'LinkAdded', api_get_user_id());
     }
     return $id;
 }
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:20,代码来源:link.lib.php

示例12: onLogoutSuccess

 /**
  * @param Request $request
  * @return null|RedirectResponse
  */
 public function onLogoutSuccess(Request $request)
 {
     $session = $request->getSession();
     \ChamiloSession::setSession($session);
     // Chamilo logout
     $userId = api_get_user_id();
     \Online::logout($userId, false);
     $login = $this->router->generate('index');
     $response = new RedirectResponse($login);
     return $response;
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:15,代码来源:LogoutSuccessHandler.php

示例13: GetFoldersAndFiles

function GetFoldersAndFiles($resourceType, $currentFolder)
{
    // Map the virtual path to the local server path.
    $sServerDir = ServerMapFolder($resourceType, $currentFolder, 'GetFoldersAndFiles');
    // Arrays that will hold the folders and files names.
    $aFolders = array();
    $aFiles = array();
    $oCurrentFolder = @opendir($sServerDir);
    $in_group = api_is_in_group();
    if ($currentFolder == '/shared_folder/' || $currentFolder == '/shared_folder_session_' . api_get_session_id() . '/') {
        $in_shared_folder = true;
    } else {
        $in_shared_folder = false;
    }
    $user_id = api_get_user_id();
    if ($oCurrentFolder !== false) {
        while ($sFile = readdir($oCurrentFolder)) {
            $is_dir = @is_dir($sServerDir . $sFile);
            if ($sFile != '.' && $sFile != '..' && strpos($sFile, '_DELETED_') === false && strpos($sFile, 'chat_files') === false && strpos($sFile, 'HotPotatoes_files') === false && ($in_group || !$in_group && strpos($sFile, '_groupdocs') === false) && (!$in_shared_folder || $in_shared_folder && (!$is_dir || $is_dir && $sFile == $user_id)) && $sFile != '.thumbs' && strpos($sFile, '.editor_') === false && $sFile != '.svn') {
                if ($is_dir) {
                    $aFolders[] = '<Folder name="' . ConvertToXmlAttribute($sFile) . '" />';
                } else {
                    $iFileSize = @filesize($sServerDir . $sFile);
                    if (!$iFileSize) {
                        $iFileSize = 0;
                    }
                    if ($iFileSize > 0) {
                        $iFileSize = round($iFileSize / 1024);
                        if ($iFileSize < 1) {
                            $iFileSize = 1;
                        }
                    }
                    $aFiles[] = '<File name="' . ConvertToXmlAttribute($sFile) . '" size="' . $iFileSize . '" />';
                }
            }
        }
        closedir($oCurrentFolder);
    }
    // Send the folders
    natcasesort($aFolders);
    echo '<Folders>';
    foreach ($aFolders as $sFolder) {
        echo $sFolder;
    }
    echo '</Folders>';
    // Send the files
    natcasesort($aFiles);
    echo '<Files>';
    foreach ($aFiles as $sFiles) {
        echo $sFiles;
    }
    echo '</Files>';
}
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:53,代码来源:commands.php

示例14: getConfiguration

 /**
  * {@inheritdoc}
  */
 public function getConfiguration()
 {
     if ($this->allow()) {
         $userId = api_get_user_id();
         if (!empty($userId)) {
             // Adding user personal files
             $dir = \UserManager::getUserPathById($userId, 'system');
             $dirWeb = \UserManager::getUserPathById($userId, 'web');
             $driver = array('driver' => 'PersonalDriver', 'alias' => get_lang('MyFiles'), 'path' => $dir . 'my_files', 'URL' => $dirWeb . 'my_files', 'accessControl' => array($this, 'access'), 'disabled' => array('duplicate', 'mkfile', 'copy', 'cut', 'paste', 'edit', 'extract', 'archive', 'help', 'resize'));
             return $driver;
         }
     }
     return array();
 }
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:17,代码来源:PersonalDriver.php

示例15: lp_ajax_log

/**
 * Write a log with the current message
 * @param   string Message
 * @param   int    Debug level (if 0, do not log)
 */
function lp_ajax_log($msg, $level) {
    $debug = 0;
    $return = '';
    if ($debug > 0) {error_log('In log('.$msg.')', 0); }
    if ($level == 0) {
        //error_log('Logging level too low, not writing files in '.__FILE__);
        return $return;
    }
    $msg = str_replace('<br />', "\r\n", $msg);
    $file = sys_get_temp_dir().DIRECTORY_SEPARATOR.session_id().'.'.date('Ymd').'-'.api_get_user_id().'.scorm.log';
    $fh = @fopen($file, 'a');
    @fwrite($fh,'['.date('Y-m-d H:m:s').'] '.$msg."\r\n");
    @fclose($fh);
    return $return;
}
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:20,代码来源:lp_ajax_log.php


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