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


PHP UserManager::get_user_id_from_username方法代码示例

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


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

示例1: fileAction

 /**
  * My files
  * @Route("/{username}/files")
  * @Method({"GET"})
  */
 public function fileAction($username)
 {
     if ($this->getUser()->getUsername() != $username) {
         return $this->abort(401);
     }
     $userId = \UserManager::get_user_id_from_username($username);
     $userInfo = api_get_user_info($userId);
     $this->getTemplate()->assign('driver_list', 'PersonalDriver,DropBoxDriver');
     $editor = $this->getTemplate()->renderTemplate($this->getHtmlEditor()->getEditorStandAloneTemplate());
     $this->getTemplate()->assign('user', $userInfo);
     $this->getTemplate()->assign('editor', $editor);
     $response = $this->getTemplate()->renderTemplate($this->getTemplatePath() . 'files.tpl');
     return new Response($response, 200, array());
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:19,代码来源:ProfileController.php

示例2: get_courses_code

 public function get_courses_code($username, $password)
 {
     if ($this->verifyUserPass($username, $password) == "valid") {
         $user_id = UserManager::get_user_id_from_username($username);
         $listOfCourses = UserManager::get_personal_session_course_list($user_id);
         $courses_id = "#";
         foreach ($listOfCourses as $course) {
             $courses_id .= $course['code'] . "#";
         }
         return $courses_id;
     } else {
         return get_lang('InvalidId');
     }
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:14,代码来源:cm_webservice_courses.php

示例3: get_announcements

 private function get_announcements($username, $course_code, $announcement_id = 0)
 {
     $session_id = api_get_session_id();
     $condition_session = api_get_session_condition($session_id);
     $announcement_id = $announcement_id == 0 ? "" : "AND announcement.id=" . $announcement_id;
     $user_id = UserManager::get_user_id_from_username($username);
     //$listOfCourses = CourseManager::get_course_information_by_id($course_id);
     $course_info = CourseManager::get_course_information($course_code);
     $course_db = $course_info['db_name'];
     $tbl_item_property = Database::get_course_table(TABLE_ITEM_PROPERTY, $course_db);
     $tbl_announcement = Database::get_course_table(TABLE_ANNOUNCEMENT, $course_db);
     $maximum = '12';
     $group_memberships = GroupManager::get_group_ids($course_info['real_id'], $user_id);
     if (api_get_group_id() == 0) {
         $cond_user_id = " AND ( ip.to_user_id='" . $user_id . "'" . "OR ip.to_group_id IN (0, " . implode(", ", $group_memberships) . ")) ";
     } else {
         $cond_user_id = " AND ( ip.to_user_id='" . $user_id . "'" . "OR ip.to_group_id IN (0, " . api_get_group_id() . ")) ";
     }
     // the user is member of several groups => display personal announcements AND his group announcements AND the general announcements
     if (is_array($group_memberships) && count($group_memberships) > 0) {
         $sql = "SELECT\n                            announcement.*, ip.visibility, ip.to_group_id, ip.insert_user_id\n                            FROM {$tbl_announcement} announcement, {$tbl_item_property} ip\n                            WHERE announcement.id = ip.ref\n                            AND ip.tool='announcement'\n                            AND ip.visibility='1'\n                            {$announcement_id}\n                            {$cond_user_id}\n                            {$condition_session}\n                            GROUP BY ip.ref\n                            ORDER BY display_order DESC\n                            LIMIT 0,{$maximum}";
     } else {
         // the user is not member of any group
         // this is an identified user => show the general announcements AND his personal announcements
         if ($user_id) {
             if (api_get_course_setting('allow_user_edit_announcement') && !api_is_anonymous()) {
                 $cond_user_id = " AND (ip.lastedit_user_id = '" . api_get_user_id() . "' OR ( ip.to_user_id='" . $user_id . "' OR ip.to_group_id='0')) ";
             } else {
                 $cond_user_id = " AND ( ip.to_user_id='" . $user_id . "' OR ip.to_group_id='0') ";
             }
             $sql = "SELECT\n                                    announcement.*, ip.visibility, ip.to_group_id, ip.insert_user_id\n                                    FROM {$tbl_announcement} announcement, {$tbl_item_property} ip\n                                    WHERE announcement.id = ip.ref\n                                    AND ip.tool='announcement'\n                                    AND ip.visibility='1'\n                                    {$announcement_id}\n                                    {$cond_user_id}\n                                    {$condition_session}\n                                    GROUP BY ip.ref\n                                    ORDER BY display_order DESC\n                                    LIMIT 0,{$maximum}";
         } else {
             if (api_get_course_setting('allow_user_edit_announcement')) {
                 $cond_user_id = " AND (ip.lastedit_user_id = '" . api_get_user_id() . "' OR ip.to_group_id='0') ";
             } else {
                 $cond_user_id = " AND ip.to_group_id='0' ";
             }
             // the user is not identiefied => show only the general announcements
             $sql = "SELECT\n                                    announcement.*, ip.visibility, ip.to_group_id, ip.insert_user_id\n                                    FROM {$tbl_announcement} announcement, {$tbl_item_property} ip\n                                    WHERE announcement.id = ip.ref\n                                    AND ip.tool='announcement'\n                                    AND ip.visibility='1'\n                                    AND ip.to_group_id='0'\n                                    {$announcement_id}\n                                    {$condition_session}\n                                    GROUP BY ip.ref\n                                    ORDER BY display_order DESC\n                                    LIMIT 0,{$maximum}";
         }
     }
     $result = Database::query($sql);
     return $result;
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:44,代码来源:cm_webservice_announcements.php

示例4: importSessionsStatic

 /**
  * Updates the session synchronize with the csv file.
  * @param string $file
  */
 private function importSessionsStatic($file)
 {
     $content = file($file);
     $sessions = array();
     if (!api_strstr($content[0], ';')) {
         $error_message = get_lang('NotCSV');
     } else {
         $tag_names = array();
         foreach ($content as $key => $enreg) {
             $enreg = explode(';', trim($enreg));
             if ($key) {
                 foreach ($tag_names as $tag_key => $tag_name) {
                     $sessions[$key - 1][$tag_name] = $enreg[$tag_key];
                 }
             } else {
                 foreach ($enreg as $tag_name) {
                     $tag_names[] = api_preg_replace('/[^a-zA-Z0-9_\\-]/', '', $tag_name);
                 }
                 if (!in_array('SessionName', $tag_names) || !in_array('DateStart', $tag_names) || !in_array('DateEnd', $tag_names)) {
                     $error_message = get_lang('NoNeededData');
                     break;
                 }
             }
         }
     }
     if (!empty($sessions)) {
         // Looping the sessions.
         foreach ($sessions as $session) {
             if (!empty($session['SessionID'])) {
                 $sessionId = SessionManager::get_session_id_from_original_id($session['SessionID'], $this->extraFieldIdNameList['session']);
                 $coachUserName = isset($session['Coach']) ? $session['Coach'] : null;
                 $categoryId = isset($session['category_id']) ? $session['category_id'] : null;
                 // 2014-06-30
                 $dateStart = explode('/', $session['DateStart']);
                 $dateEnd = explode('/', $session['DateEnd']);
                 $visibility = $this->defaultSessionVisibility;
                 $coachId = null;
                 if (!empty($coachUserName)) {
                     $coachInfo = api_get_user_info_from_username($coachUserName);
                     $coachId = $coachInfo['user_id'];
                 }
                 if (empty($sessionId)) {
                     $result = SessionManager::create_session($session['SessionName'], $dateStart[0], $dateStart[1], $dateStart[2], $dateEnd[0], $dateEnd[1], $dateEnd[2], $this->daysCoachAccessBeforeBeginning, $this->daysCoachAccessAfterBeginning, null, $coachUserName, $categoryId, $visibility, 1);
                     if (is_numeric($result)) {
                         $sessionId = $result;
                         SessionManager::update_session_extra_field_value($sessionId, $this->extraFieldIdNameList['session'], $session['SessionID']);
                     }
                 } else {
                     $sessionInfo = api_get_session_info($sessionId);
                     $accessBefore = null;
                     $accessAfter = null;
                     if (empty($sessionInfo['nb_days_access_before_beginning']) || !empty($sessionInfo['nb_days_access_before_beginning']) && $sessionInfo['nb_days_access_before_beginning'] < $this->daysCoachAccessBeforeBeginning) {
                         $accessBefore = intval($this->daysCoachAccessBeforeBeginning);
                     }
                     $accessAfter = null;
                     if (empty($sessionInfo['nb_days_access_after_end']) || !empty($sessionInfo['nb_days_access_after_end']) && $sessionInfo['nb_days_access_after_end'] < $this->daysCoachAccessAfterBeginning) {
                         $accessAfter = intval($this->daysCoachAccessAfterBeginning);
                     }
                     $showDescription = isset($sessionInfo['show_description']) ? $sessionInfo['show_description'] : 1;
                     $result = SessionManager::edit_session($sessionId, $session['SessionName'], $dateStart[0], $dateStart[1], $dateStart[2], $dateEnd[0], $dateEnd[1], $dateEnd[2], $accessBefore, $accessAfter, null, $coachId, $categoryId, $visibility, true, true, null, $showDescription);
                     if (is_numeric($result)) {
                         $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
                         $params = array('description' => $session['SessionDescription']);
                         Database::update($tbl_session, $params, array('id = ?' => $sessionId));
                     }
                 }
                 // Courses
                 $courses = explode('|', $session['Courses']);
                 $courseList = array();
                 foreach ($courses as $course) {
                     $courseArray = bracketsToArray($course);
                     $courseCode = $courseArray[0];
                     if (CourseManager::course_exists($courseCode)) {
                         $courseList[] = $courseCode;
                     }
                 }
                 SessionManager::add_courses_to_session($sessionId, $courseList, true);
                 if (!empty($sessionId)) {
                     $courses = explode('|', $session['Courses']);
                     foreach ($courses as $course) {
                         $courseArray = bracketsToArray($course);
                         $courseCode = $courseArray[0];
                         if (CourseManager::course_exists($courseCode)) {
                             // Coaches
                             $courseCoaches = isset($courseArray[1]) ? $courseArray[1] : null;
                             $courseCoaches = explode(',', $courseCoaches);
                             if (!empty($courseCoaches)) {
                                 $coachList = array();
                                 foreach ($courseCoaches as $courseCoach) {
                                     $courseCoachId = UserManager::get_user_id_from_username($courseCoach);
                                     if ($courseCoachId !== false) {
                                         // Just insert new coaches
                                         $coachList[] = $courseCoachId;
                                     }
                                 }
                                 SessionManager::updateCoaches($sessionId, $courseCode, $coachList, true);
//.........这里部分代码省略.........
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:101,代码来源:import_csv.php

示例5: importCSV

 /**
  * @param string $file
  * @param bool $updatesession options:
  * true: if the session exists it will be updated
  * false: if session exists a new session will be created adding a counter session1, session2, etc
  * @param int $user_id
  * @param $logger
  * @param array convert a file row to an extra field. Example in CSV file there's a SessionID then it will
  * converted to extra_external_session_id if you set this: array('SessionId' => 'extra_external_session_id')
  * @param array extra fields
  * @param string extra field id
  * @param int $daysCoachAccessBeforeBeginning
  * @param int $daysCoachAccessAfterBeginning
  * @param int $sessionVisibility
  * @return array
  */
 static function importCSV($file, $updatesession, $defaultUserId = null, $logger = null, $extraFields = array(), $extraFieldId = null, $daysCoachAccessBeforeBeginning = null, $daysCoachAccessAfterBeginning = null, $sessionVisibility = 1, $fieldsToAvoidUpdate = array())
 {
     $content = file($file);
     $error_message = null;
     $session_counter = 0;
     if (empty($defaultUserId)) {
         $defaultUserId = api_get_user_id();
     }
     $eol = PHP_EOL;
     if (PHP_SAPI != 'cli') {
         $eol = '<br />';
     }
     $debug = false;
     if (isset($logger)) {
         $debug = true;
     }
     $extraParameters = null;
     if (!empty($daysCoachAccessBeforeBeginning) && !empty($daysCoachAccessAfterBeginning)) {
         $extraParameters .= ' , nb_days_access_before_beginning = ' . intval($daysCoachAccessBeforeBeginning);
         $extraParameters .= ' , nb_days_access_after_end = ' . intval($daysCoachAccessAfterBeginning);
     }
     $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
     $tbl_session_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
     $tbl_session_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
     $tbl_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
     $sessions = array();
     if (!api_strstr($content[0], ';')) {
         $error_message = get_lang('NotCSV');
     } else {
         $tag_names = array();
         foreach ($content as $key => $enreg) {
             $enreg = explode(';', trim($enreg));
             if ($key) {
                 foreach ($tag_names as $tag_key => $tag_name) {
                     $sessions[$key - 1][$tag_name] = $enreg[$tag_key];
                 }
             } else {
                 foreach ($enreg as $tag_name) {
                     $tag_names[] = api_preg_replace('/[^a-zA-Z0-9_\\-]/', '', $tag_name);
                 }
                 if (!in_array('SessionName', $tag_names) || !in_array('DateStart', $tag_names) || !in_array('DateEnd', $tag_names)) {
                     $error_message = get_lang('NoNeededData');
                     break;
                 }
             }
         }
         // Looping the sessions.
         foreach ($sessions as $enreg) {
             $user_counter = 0;
             $course_counter = 0;
             if (isset($extraFields) && !empty($extraFields)) {
                 foreach ($extraFields as $original => $to) {
                     $enreg[$to] = $enreg[$original];
                 }
             }
             $session_name = Database::escape_string($enreg['SessionName']);
             $date_start = $enreg['DateStart'];
             $date_end = $enreg['DateEnd'];
             $visibility = isset($enreg['Visibility']) ? $enreg['Visibility'] : $sessionVisibility;
             $session_category_id = isset($enreg['SessionCategory']) ? $enreg['SessionCategory'] : null;
             // Searching a general coach.
             if (!empty($enreg['Coach'])) {
                 $coach_id = UserManager::get_user_id_from_username($enreg['Coach']);
                 if ($coach_id === false) {
                     // If the coach-user does not exist - I'm the coach.
                     $coach_id = $defaultUserId;
                 }
             } else {
                 $coach_id = $defaultUserId;
             }
             if (!$updatesession) {
                 // Always create a session.
                 $unique_name = false;
                 // This MUST be initializead.
                 $i = 0;
                 // Change session name, verify that session doesn't exist.
                 $suffix = null;
                 while (!$unique_name) {
                     if ($i > 1) {
                         $suffix = ' - ' . $i;
                     }
                     $sql = 'SELECT 1 FROM ' . $tbl_session . ' WHERE name="' . $session_name . $suffix . '"';
                     $rs = Database::query($sql);
                     if (Database::result($rs, 0, 0)) {
//.........这里部分代码省略.........
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:101,代码来源:sessionmanager.lib.php

示例6: array

$user_to_show = array();
$type = '';
if ($form->validate()) {
    if (isset($_FILES['import_file']['size']) && $_FILES['import_file']['size'] !== 0) {
        $unsubscribe_users = isset($_POST['unsubscribe_users']) ? true : false;
        $users = Import::csv_to_array($_FILES['import_file']['tmp_name']);
        $invalid_users = array();
        $clean_users = array();
        if (!empty($users)) {
            $empty_line = 0;
            foreach ($users as $user_data) {
                $user_id = null;
                $user_data = array_change_key_case($user_data, CASE_LOWER);
                // Checking "username" field
                if (isset($user_data['username']) && !empty($user_data['username'])) {
                    $user_id = UserManager::get_user_id_from_username($user_data['username']);
                }
                // Checking "id" field
                if (isset($user_data['id']) && !empty($user_data['id'])) {
                    $user_id = $user_data['id'];
                }
                if (UserManager::is_user_id_valid($user_id)) {
                    $clean_users[] = $user_id;
                } else {
                    $invalid_users[] = $user_data;
                }
            }
            if (empty($invalid_users)) {
                $type = 'confirmation';
                $message = get_lang('ListOfUsersSubscribedToCourse');
                if ($unsubscribe_users) {
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:31,代码来源:user_import.php

示例7: foreach

 foreach ($course_coaches as $course_coach) {
     $coach_id = UserManager::purify_username(api_utf8_decode($course_coach), $purification_option_for_usernames);
     $coach_id = UserManager::get_user_id_from_username($course_coach);
     if ($coach_id !== false) {
         $sql = "INSERT IGNORE INTO {$tbl_session_course_user} SET\n                                                        id_user='{$coach_id}',\n                                                        course_code='{$vcourse['code']}',\n                                                        id_session = '{$session_id}',\n                                                        status = 2 ";
         $rs_coachs = Database::query($sql);
     } else {
         $error_message .= get_lang('UserDoesNotExist') . ' : ' . $user . '<br />';
     }
 }
 // adding users
 $course_counter++;
 $users_in_course_counter = 0;
 foreach ($node_course->User as $node_user) {
     $username = UserManager::purify_username(api_utf8_decode($node_user), $purification_option_for_usernames);
     $user_id = UserManager::get_user_id_from_username($username);
     if ($user_id !== false) {
         // Adding to session_rel_user table.
         $sql = "INSERT IGNORE INTO {$tbl_session_user} SET\n                                                        id_user='{$user_id}',\n                                                        id_session = '{$session_id}'";
         $rs_user = Database::query($sql);
         $user_counter++;
         // Adding to session_rel_user_rel_course table.
         $sql = "INSERT IGNORE INTO {$tbl_session_course_user} SET\n                                                        id_user='{$user_id}',\n                                                        course_code='{$vcourse['code']}',\n                                                        id_session = '{$session_id}'";
         $rs_users = Database::query($sql);
         $users_in_course_counter++;
     } else {
         $error_message .= get_lang('UserDoesNotExist') . ' : ' . $username . '<br />';
     }
 }
 $update_session_course = "UPDATE {$tbl_session_course} SET nbr_users='{$users_in_course_counter}' WHERE course_code='{$course_code}'";
 Database::query($update_session_course);
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:31,代码来源:session_import.php

示例8: WSEventsList

/**
 * Get a list of events between two dates for the given username
 * Function registered as service. Returns strings in UTF-8.
 * @param string Username
 * @param string User's API key (the user's API key)
 * @param int    Start date, in YYYYMMDD format
 * @param int    End date, in YYYYMMDD format
 * @return array Events list
 */
function WSEventsList($username, $signature, $datestart = 0, $dateend = 0)
{
    if (empty($username) or empty($signature)) {
        return -1;
    }
    global $_configuration;
    $info = api_get_user_info_from_username($username);
    $user_id = $info['user_id'];
    $list = UserManager::get_api_keys($user_id, 'dokeos');
    $key = '';
    foreach ($list as $key) {
        break;
    }
    $local_key = $username . $key;
    if (!api_is_valid_secret_key($signature, $local_key)) {
        return -1;
        // The secret key is incorrect.
    }
    $events_list = array();
    $user_id = UserManager::get_user_id_from_username($username);
    if ($user_id === false) {
        return $events_list;
    }
    // Error in user id recovery.
    $ds = substr($datestart, 0, 4) . '-' . substr($datestart, 4, 2) . '-' . substr($datestart, 6, 2) . ' 00:00:00';
    $de = substr($dateend, 0, 4) . '-' . substr($dateend, 4, 2) . '-' . substr($dateend, 6, 2) . ' 00:00:00';
    $events_list = Agenda::get_personal_agenda_items_between_dates($user_id, $ds, $de);
    return $events_list;
}
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:38,代码来源:user_info.soap.php

示例9: parse_xml_data

 }
 $eval[0]->check_lock_permissions();
 if ($_POST['formSent']) {
     if (!empty($_FILES['import_file']['name'])) {
         $values = $import_result_form->exportValues();
         $file_type = $_POST['file_type'];
         $file_name = $_FILES['import_file']['tmp_name'];
         if ($file_type == 'csv') {
             $results = Import::csvToArray($file_name);
         } else {
             $results = parse_xml_data($file_name);
         }
         $nr_results_added = 0;
         foreach ($results as $index => $importedresult) {
             //check username & score
             $importedresult['user_id'] = UserManager::get_user_id_from_username($importedresult['username']);
             $added = '0';
             foreach ($allresults as $allresult) {
                 if ($importedresult['user_id'] == $allresult->get_user_id()) {
                     if ($importedresult['score'] != $allresult->get_score()) {
                         if (!isset($values['overwrite'])) {
                             header('Location: gradebook_view_result.php?selecteval=' . Security::remove_XSS($_GET['selecteval']) . '&import_score_error=' . $importedresult['user_id']);
                             exit;
                             break;
                         } else {
                             GradebookUtils::overwritescore($allresult->get_id(), $importedresult['score'], $eval[0]->get_max());
                             $overwritescore++;
                             $added = '1';
                         }
                     } else {
                         $added = '1';
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:gradebook_view_result.php

示例10: importCSV


//.........这里部分代码省略.........
                     $enreg[$to] = isset($enreg[$original]) ? $enreg[$original] : null;
                 }
             }
             $session_name = Database::escape_string($enreg['SessionName']);
             // Default visibility
             $visibilityAfterExpirationPerSession = $sessionVisibility;
             if (isset($enreg['VisibilityAfterExpiration'])) {
                 $visibility = $enreg['VisibilityAfterExpiration'];
                 switch ($visibility) {
                     case 'read_only':
                         $visibilityAfterExpirationPerSession = SESSION_VISIBLE_READ_ONLY;
                         break;
                     case 'accessible':
                         $visibilityAfterExpirationPerSession = SESSION_VISIBLE;
                         break;
                     case 'not_accessible':
                         $visibilityAfterExpirationPerSession = SESSION_INVISIBLE;
                         break;
                 }
             }
             if (empty($session_name)) {
                 continue;
             }
             $date_start = $enreg['DateStart'];
             $date_end = $enreg['DateEnd'];
             $session_category_id = isset($enreg['SessionCategory']) ? $enreg['SessionCategory'] : null;
             $sessionDescription = isset($enreg['SessionDescription']) ? $enreg['SessionDescription'] : null;
             $extraSessionParameters = null;
             if (!empty($sessionDescription)) {
                 $extraSessionParameters = " , description = '" . Database::escape_string($sessionDescription) . "'";
             }
             // Searching a general coach.
             if (!empty($enreg['Coach'])) {
                 $coach_id = UserManager::get_user_id_from_username($enreg['Coach']);
                 if ($coach_id === false) {
                     // If the coach-user does not exist - I'm the coach.
                     $coach_id = $defaultUserId;
                 }
             } else {
                 $coach_id = $defaultUserId;
             }
             if (!$updateSession) {
                 // Always create a session.
                 $unique_name = false;
                 $i = 0;
                 // Change session name, verify that session doesn't exist.
                 $suffix = null;
                 while (!$unique_name) {
                     if ($i > 1) {
                         $suffix = ' - ' . $i;
                     }
                     $sql = 'SELECT 1 FROM ' . $tbl_session . '
                             WHERE name="' . $session_name . $suffix . '"';
                     $rs = Database::query($sql);
                     if (Database::result($rs, 0, 0)) {
                         $i++;
                     } else {
                         $unique_name = true;
                         $session_name .= $suffix;
                     }
                 }
                 $sessionCondition = '';
                 if (!empty($session_category_id)) {
                     $sessionCondition = "session_category_id = '{$session_category_id}',";
                 }
                 // Creating the session.
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:67,代码来源:sessionmanager.lib.php

示例11: message_send

 public function message_send($username, $password, $receiver_user_id, $subject, $content)
 {
     //TODO: verificar data de envio. Esta divergindo de data!
     if ($this->verifyUserPass($username, $password) == "valid") {
         $group_id = intval(0);
         $parent_id = intval(0);
         $edit_message_id = intval(0);
         $sent_email = false;
         $user_sender_id = UserManager::get_user_id_from_username($username);
         $subject = htmlentities($subject);
         $content = htmlentities($content);
         $table_message = Database::get_main_table(TABLE_MESSAGE);
         $query = "INSERT INTO {$table_message}(user_sender_id, user_receiver_id, msg_status, send_date, title, content, group_id, parent_id, update_date ) " . " VALUES ('{$user_sender_id}', '{$receiver_user_id}', '1', '" . api_get_utc_datetime() . "','{$subject}','{$content}','{$group_id}','{$parent_id}', '" . api_get_utc_datetime() . "')";
         $result = Database::query($query);
         $query = "INSERT INTO {$table_message}(user_sender_id, user_receiver_id, msg_status, send_date, title, content, group_id, parent_id, update_date ) " . " VALUES ('{$user_sender_id}', '{$receiver_user_id}', '4', '" . api_get_utc_datetime() . "','{$subject}','{$content}','{$group_id}','{$parent_id}', '" . api_get_utc_datetime() . "')";
         $result = Database::query($query);
         $inbox_last_id = Database::insert_id();
         return $inbox_last_id;
     } else {
         return get_lang('InvalidId');
     }
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:22,代码来源:cm_webservice_inbox.php

示例12: profileAction

 /**
  * @Route("/{username}")
  * @Method({"GET"})
  * @Template("ChamiloCoreBundle:User:profile.html.twig")
  */
 public function profileAction($username)
 {
     $userId = \UserManager::get_user_id_from_username($username);
     $userInfo = api_get_user_info($userId);
     return array('user' => $userInfo, 'form_send_message' => \MessageManager::generate_message_form('send_message'), 'form_send_invitation' => \MessageManager::generate_invitation_form('send_invitation'));
 }
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:11,代码来源:UserController.php

示例13: denied_invitation

 public function denied_invitation($username, $password, $userfriend_id)
 {
     if ($this->verifyUserPass($username, $password) == "valid") {
         $user_id = UserManager::get_user_id_from_username($username);
         SocialManager::invitation_denied($userfriend_id, $user_id);
         return get_lang('InvitationDenied');
     }
     return get_lang('InvalidId');
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:9,代码来源:cm_webservice_user.php

示例14: unreadMessage

    public function unreadMessage($username, $password)
    {
        if($this->verifyUserPass($username, $password) == "valid")
        {
            $table_message = Database::get_main_table(TABLE_MESSAGE);
            $user_id = UserManager::get_user_id_from_username($username);
            $condition_msg_status = ' msg_status = 1 '; // define('MESSAGE_STATUS_UNREAD', '1');

            $sql_query = "SELECT COUNT(*) as number_messages FROM $table_message WHERE $condition_msg_status AND user_receiver_id=".$user_id;

            $sql_result = Database::query($sql_query);
            $result = Database::fetch_array($sql_result);
            return $result['number_messages'];
        }
        return "0";
    }
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:16,代码来源:cm_webservice_course.php

示例15: send_post

 public function send_post($username, $password, $course_code, $forum_id, $thread_id, $title, $content)
 {
     if ($this->verifyUserPass($username, $password) == "valid") {
         $course_db = CourseManager::get_course_information($course_code);
         $user_id = UserManager::get_user_id_from_username($username);
         $table_threads = Database::get_course_table(TABLE_FORUM_THREAD, $course_db['db_name']);
         $forum_table_attachment = Database::get_course_table(TABLE_FORUM_ATTACHMENT, $course_db['db_name']);
         $table_posts = Database::get_course_table(TABLE_FORUM_POST, $course_db['db_name']);
         $post_date = date('Y-m-d H:i:s');
         $visible = 1;
         $has_attachment = false;
         $my_post = '';
         $post_notification = '';
         $content = nl2br($content);
         $title = htmlentities($title);
         $content = htmlentities($content);
         $sql = "INSERT INTO {$table_posts} (post_title, post_text, thread_id, forum_id, poster_id, post_date, post_notification, post_parent_id, visible)\n                            VALUES ('" . Database::escape_string($title) . "',\n                                            '" . Database::escape_string(isset($content) ? api_html_entity_decode($content) : null) . "',\n                                            '" . Database::escape_string($thread_id) . "',\n                                            '" . Database::escape_string($forum_id) . "',\n                                            '" . Database::escape_string($user_id) . "',\n                                            '" . Database::escape_string($post_date) . "',\n                                            '" . Database::escape_string(isset($post_notification) ? $post_notification : null) . "',\n                                            '" . Database::escape_string(isset($my_post) ? $my_post : null) . "',\n                                            '" . Database::escape_string($visible) . "')";
         $result = Database::query($sql);
         return "Post enviado!";
         //return $sql;
         //send_notification_mails($thread_id, $values);
     } else {
         return get_lang('InvalidId');
     }
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:25,代码来源:cm_webservice_forum.php


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