本文整理汇总了PHP中api_get_session_info函数的典型用法代码示例。如果您正苦于以下问题:PHP api_get_session_info函数的具体用法?PHP api_get_session_info怎么用?PHP api_get_session_info使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了api_get_session_info函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Creates the mPDF object
* @param string $pageFormat format A4 A4-L see http://mpdf1.com/manual/index.php?tid=184&searchstring=format
* @param string $orientation orientation "P" = Portrait "L" = Landscape
* @param array $params
* @param Template $template
*/
public function __construct($pageFormat = 'A4', $orientation = 'P', $params = array(), $template = null)
{
$this->template = $template;
/* More info @ http://mpdf1.com/manual/index.php?tid=184&searchstring=mPDF
* mPDF ([ string $mode [, mixed $format [, float $default_font_size [, string $default_font [, float $margin_left , float $margin_right , float $margin_top , float $margin_bottom , float $margin_header , float $margin_footer [, string $orientation ]]]]]])
*/
if (!in_array($orientation, array('P', 'L'))) {
$orientation = 'P';
}
//$this->pdf = $pdf = new mPDF('UTF-8', $pageFormat, '', '', 30, 20, 27, 25, 16, 13, $orientation);
//left, right, top, bottom, margin_header, margin footer
$params['left'] = isset($params['left']) ? $params['left'] : 15;
$params['right'] = isset($params['right']) ? $params['right'] : 15;
$params['top'] = isset($params['top']) ? $params['top'] : 20;
$params['bottom'] = isset($params['bottom']) ? $params['bottom'] : 15;
$this->params['filename'] = isset($params['filename']) ? $params['filename'] : api_get_local_time();
$this->params['pdf_title'] = isset($params['pdf_title']) ? $params['pdf_title'] : get_lang('Untitled');
$this->params['course_info'] = isset($params['course_info']) ? $params['course_info'] : api_get_course_info();
$this->params['session_info'] = isset($params['session_info']) ? $params['session_info'] : api_get_session_info(api_get_session_id());
$this->params['course_code'] = isset($params['course_code']) ? $params['course_code'] : api_get_course_id();
$this->params['add_signatures'] = isset($params['add_signatures']) ? $params['add_signatures'] : false;
$this->params['show_real_course_teachers'] = isset($params['show_real_course_teachers']) ? $params['show_real_course_teachers'] : false;
$this->params['student_info'] = isset($params['student_info']) ? $params['student_info'] : false;
$this->params['show_grade_generated_date'] = isset($params['show_grade_generated_date']) ? $params['show_grade_generated_date'] : false;
$this->params['show_teacher_as_myself'] = isset($params['show_teacher_as_myself']) ? $params['show_teacher_as_myself'] : true;
$this->params['pdf_date'] = isset($params['pdf_date']) ? $params['pdf_date'] : api_format_date(api_get_local_time(), DATE_TIME_FORMAT_LONG);
$this->pdf = new mPDF('UTF-8', $pageFormat, '', '', $params['left'], $params['right'], $params['top'], $params['bottom'], 8, 8, $orientation);
}
示例2: getRequirementAndDependencies
/**
* @todo implement for all types only work for sessions
*
* @param int $resourceId
* @param int $type
*
* @return array
*/
public function getRequirementAndDependencies($resourceId, $type)
{
$sequence = $this->findRequirementForResource($resourceId, $type);
$result = ['requirements' => '', 'dependencies' => ''];
if ($sequence && $sequence->hasGraph()) {
$graph = $sequence->getSequence()->getUnSerializeGraph();
$vertex = $graph->getVertex($resourceId);
$from = $vertex->getVerticesEdgeFrom();
foreach ($from as $subVertex) {
$vertexId = $subVertex->getId();
$sessionInfo = api_get_session_info($vertexId);
$sessionInfo['admin_link'] = '<a href="' . \SessionManager::getAdminPath($vertexId) . '">' . $sessionInfo['name'] . '</a>';
$result['requirements'][] = $sessionInfo;
}
$to = $vertex->getVerticesEdgeTo();
foreach ($to as $subVertex) {
$vertexId = $subVertex->getId();
$sessionInfo = api_get_session_info($vertexId);
$sessionInfo['admin_link'] = '<a href="' . \SessionManager::getAdminPath($vertexId) . '">' . $sessionInfo['name'] . '</a>';
$result['dependencies'][] = $sessionInfo;
}
}
return $result;
}
示例3: get_lang
SessionManager::protectSession($sessionId);
$tool_name = get_lang('SessionOverview');
//$interbreadcrumb[] = array('url' => 'index.php','name' => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => 'session_list.php', 'name' => get_lang('SessionList'));
$orig_param = '&origin=resume_session';
// Database Table Definitions
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$tbl_session_rel_class = Database::get_main_table(TABLE_MAIN_SESSION_CLASS);
$tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
$tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
$tbl_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
$tbl_session_rel_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$tbl_session_category = Database::get_main_table(TABLE_MAIN_SESSION_CATEGORY);
$table_access_url_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
$sessionInfo = api_get_session_info($sessionId);
$session = Database::getManager()->find('ChamiloCoreBundle:Session', $sessionId);
$sessionCategory = $session->getCategory();
$action = isset($_GET['action']) ? $_GET['action'] : null;
$url_id = api_get_current_access_url_id();
switch ($action) {
case 'move_up':
SessionManager::moveUp($sessionId, $_GET['course_id']);
header('Location: resume_session.php?id_session=' . $sessionId);
exit;
break;
case 'move_down':
SessionManager::moveDown($sessionId, $_GET['course_id']);
header('Location: resume_session.php?id_session=' . $sessionId);
exit;
break;
示例4: show_session_data
/**
* Shows the general data for a particular meeting
*
* @param id session id
* @return string session data
*/
public static function show_session_data($id_session)
{
if ($id_session != strval(intval($id_session))) {
return '';
} else {
$id_session = intval($id_session);
}
$session_info = api_get_session_info($id_session);
$session_category = SessionManager::get_session_category($session_info['session_category_id']);
$session_category_name = null;
if (!empty($session_category)) {
$session_category_name = $session_category['name'];
}
$user_info = api_get_user_info($session_info['id_coach']);
$general_coach = null;
if (!empty($user_info)) {
$general_coach = $user_info['complete_name'] . ' (' . $user_info['username'] . ')';
}
$msg_date = SessionManager::parse_session_dates($session_info);
$output = '';
if (!empty($session_category)) {
$output .= '<tr><td>' . get_lang('SessionCategory') . ': ' . '<b>' . $session_category_name . '</b></td></tr>';
}
$output .= '<tr>
<td style="width:50%">' . get_lang('SessionName') . ': ' . '<b>' . $session_info['name'] . '</b></td>
<td>' . get_lang('GeneralCoach') . ': ' . '<b>' . $general_coach . '</b></td></tr>';
$output .= '<tr><td>' . get_lang('SessionIdentifier') . ': ' . Display::return_icon('star.png', ' ', array('align' => 'absmiddle')) . '</td>
<td>' . get_lang('Date') . ': ' . '<b>' . $msg_date . '</b></td></tr>';
return $output;
}
示例5: isSessionDateOkForCoach
/**
* Return true if coach is allowed to access this session
* @param int $sessionId
* @return bool
*/
public static function isSessionDateOkForCoach($sessionId)
{
return api_get_session_visibility($sessionId);
$listSessionInfo = api_get_session_info($sessionId);
$dateStart = $listSessionInfo['date_start'];
$dateEnd = $listSessionInfo['date_end'];
$nbDaysAccessBeforeBeginning = $listSessionInfo['nb_days_access_before_beginning'];
$nbDaysAccessAfterEnd = $listSessionInfo['nb_days_access_after_end'];
// no start date
if ($dateStart == '0000-00-00') {
return true;
}
$now = time();
$dateStartForCoach = api_strtotime($dateStart . ' 00:00:00') - $nbDaysAccessBeforeBeginning * 86400;
$dateEndForCoach = api_strtotime($dateEnd . ' 00:00:00') + $nbDaysAccessAfterEnd * 86400;
if ($dateEnd == '0000-00-00') {
// start date but no end date
if ($dateStartForCoach <= $now) {
return true;
}
} else {
// start date and end date
if ($dateStartForCoach <= $now && $now <= $dateEndForCoach) {
return true;
}
}
return false;
}
示例6: importUnsubscribeStatic
/**
* @param string $file
*/
private function importUnsubscribeStatic($file, $moveFile = false, &$teacherBackup = array(), &$groupBackup = array())
{
$data = Import::csv_reader($file);
if (!empty($data)) {
$this->logger->addInfo(count($data) . " records found.");
foreach ($data as $row) {
$chamiloUserName = $row['UserName'];
$chamiloCourseCode = $row['CourseCode'];
$chamiloSessionId = $row['SessionID'];
$sessionInfo = api_get_session_info($chamiloSessionId);
if (empty($sessionInfo)) {
$this->logger->addError('Session does not exists: ' . $chamiloSessionId);
continue;
}
$courseInfo = api_get_course_info($chamiloCourseCode);
if (empty($courseInfo)) {
$this->logger->addError('Course does not exists: ' . $courseInfo);
continue;
}
$userId = Usermanager::get_user_id_from_username($chamiloUserName);
if (empty($userId)) {
$this->logger->addError('User does not exists: ' . $chamiloUserName);
continue;
}
$sql = "SELECT * FROM " . Database::get_main_table(TABLE_MAIN_COURSE_USER) . "\n WHERE\n user_id = " . $userId . " AND\n course_code = '" . $courseInfo['code'] . "'\n ";
$result = Database::query($sql);
$userCourseData = Database::fetch_array($result, 'ASSOC');
$teacherBackup[$userId][$courseInfo['code']] = $userCourseData;
$sql = "SELECT * FROM " . Database::get_course_table(TABLE_GROUP_USER) . "\n WHERE\n user_id = " . $userId . " AND\n c_id = '" . $courseInfo['real_id'] . "'\n ";
$result = Database::query($sql);
while ($groupData = Database::fetch_array($result, 'ASSOC')) {
$groupBackup['user'][$userId][$courseInfo['code']][$groupData['group_id']] = $groupData;
}
$sql = "SELECT * FROM " . Database::get_course_table(TABLE_GROUP_TUTOR) . "\n WHERE\n user_id = " . $userId . " AND\n c_id = '" . $courseInfo['real_id'] . "'\n ";
$result = Database::query($sql);
while ($groupData = Database::fetch_array($result, 'ASSOC')) {
$groupBackup['tutor'][$userId][$courseInfo['code']][$groupData['group_id']] = $groupData;
}
CourseManager::unsubscribe_user($userId, $courseInfo['code'], $chamiloSessionId);
$this->logger->addError("User '{$chamiloUserName}' was removed from session: #{$chamiloSessionId}, Course: " . $courseInfo['code']);
}
}
}
示例7: WSSubscribeUserToSessionSimple
function WSSubscribeUserToSessionSimple($params)
{
global $debug;
if ($debug) {
error_log('WSSubscribeUserToSessionSimple with params=[' . serialize($params) . ']');
}
// Check security key
if (!WSHelperVerifyKey($params)) {
return return_error(WS_ERROR_SECRET_KEY);
}
// Get input parameters
$session_id = intval($params['session']);
// Session ID
$user_id = intval($params['user_id']);
// Chamilo user id
// Get user id
$user_data = api_get_user_info($user_id);
// Prepare answer
$result = 0;
if (empty($user_data)) {
$result = "User {$user_id} does not exist";
if ($debug) {
error_log($result);
}
return $result;
}
if (!empty($session_id) && is_numeric($session_id)) {
$session_data = api_get_session_info($session_id);
if (empty($session_data)) {
$result = "Session {$session_id} does not exist.";
if ($debug) {
error_log($result);
}
} else {
SessionManager::suscribe_users_to_session($session_id, array($user_id), SESSION_VISIBLE_READ_ONLY, false);
if ($debug) {
error_log('User registered to the course: ' . $session_id);
}
$result = 1;
}
}
return $result;
}
示例8: generateTable
/**
* @param int $userId
* @param int $categoryId
* @param bool $saveToFile
* @param bool $saveToHtmlFile
*
* @return string
*/
public static function generateTable($userId, $categoryId, $saveToFile = false, $saveToHtmlFile = false)
{
$courseInfo = api_get_course_info();
$userInfo = api_get_user_info($userId);
$cats = Category::load($categoryId, null, null, null, null, null, false);
$cat = $cats[0];
$allcat = $cats[0]->get_subcategories($userId, api_get_course_id(), api_get_session_id());
$alleval = $cats[0]->get_evaluations($userId);
$alllink = $cats[0]->get_links($userId);
$gradebooktable = new GradebookTable($cat, $allcat, $alleval, $alllink, null, true, false, $userId);
if (api_is_allowed_to_edit()) {
$gradebooktable->td_attributes = [4 => 'class=centered'];
} else {
$gradebooktable->td_attributes = [3 => 'class=centered', 4 => 'class=centered', 5 => 'class=centered', 6 => 'class=centered', 7 => 'class=centered'];
}
$table = $gradebooktable->return_table();
$graph = $gradebooktable->getGraph();
$sessionName = api_get_session_name(api_get_session_id());
$sessionName = !empty($sessionName) ? " - {$sessionName}" : '';
$params = array('pdf_title' => $courseInfo['title'] . $sessionName, 'course_code' => api_get_course_id(), 'session_info' => api_get_session_info(api_get_session_id()), 'add_signatures' => false, 'student_info' => $userInfo, 'show_grade_generated_date' => true, 'show_real_course_teachers' => true);
$file = api_get_path(SYS_ARCHIVE_PATH) . uniqid() . '.html';
$content = $table . $graph . '<br />' . get_lang('Feedback') . '<br />
<textarea rows="5" cols="100" ></textarea>';
$pdf = new PDF('A4', $params['orientation'], $params);
$result = $pdf->html_to_pdf_with_template($content, $saveToFile, $saveToHtmlFile);
if ($saveToHtmlFile) {
file_put_contents($file, $result);
return $file;
}
return $file;
}
示例9: suscribe_users_to_session
/**
* Subscribes users (students) to the given session and optionally (default) unsubscribes previous users
* @author Carlos Vargas from existing code
* @param integer Session ID
* @param array List of user IDs
* @param bool Whether to unsubscribe existing users (true, default) or not (false)
* @return void Nothing, or false on error
**/
public static function suscribe_users_to_session($id_session, $user_list, $session_visibility = SESSION_VISIBLE_READ_ONLY, $empty_users = true, $send_email = false)
{
if ($id_session != strval(intval($id_session))) {
return false;
}
foreach ($user_list as $intUser) {
if ($intUser != strval(intval($intUser))) {
return false;
}
}
$tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
$tbl_session_rel_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$tbl_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$session_info = api_get_session_info($id_session);
if ($session_info) {
$session_name = $session_info['name'];
} else {
return false;
}
//from function parameter
if (empty($session_visibility)) {
$session_visibility = $session_info['visibility'];
//loaded from DB
//default status loaded if empty
if (empty($session_visibility)) {
$session_visibility = SESSION_VISIBLE_READ_ONLY;
}
// by default readonly 1
} else {
if (!in_array($session_visibility, array(SESSION_VISIBLE_READ_ONLY, SESSION_VISIBLE, SESSION_INVISIBLE))) {
$session_visibility = SESSION_VISIBLE_READ_ONLY;
}
}
$sql = "SELECT id_user FROM {$tbl_session_rel_course_rel_user} WHERE id_session = '{$id_session}' AND status = 0";
$result = Database::query($sql);
$existingUsers = array();
while ($row = Database::fetch_array($result)) {
$existingUsers[] = $row['id_user'];
}
$sql = "SELECT c_id FROM {$tbl_session_rel_course} WHERE id_session = '{$id_session}'";
$result = Database::query($sql);
$course_list = array();
while ($row = Database::fetch_array($result)) {
$course_list[] = $row['c_id'];
}
if ($send_email) {
//sending emails only
if (is_array($user_list) && count($user_list) > 0) {
foreach ($user_list as $user_id) {
if (!in_array($user_id, $existingUsers)) {
$subject = '[' . get_setting('siteName') . '] ' . get_lang('YourReg') . ' ' . get_setting('siteName');
$user_info = api_get_user_info($user_id);
$content = get_lang('Dear') . " " . stripslashes($user_info['complete_name']) . ",\n\n" . sprintf(get_lang('YouAreRegisterToSessionX'), $session_name) . " \n\n" . get_lang('Address') . " " . api_get_setting('siteName') . " " . get_lang('Is') . " : " . api_get_path(WEB_PATH) . "\n\n" . get_lang('Problem') . "\n\n" . get_lang('Formula') . ",\n\n" . get_setting('administratorName') . " " . get_setting('administratorSurname') . "\n" . get_lang('Manager') . " " . get_setting('siteName') . "\nT. " . get_setting('administratorTelephone') . "\n" . get_lang('Email') . " : " . get_setting('emailAdministrator');
MessageManager::send_message($user_id, $subject, $content, array(), array(), null, null, null, null, null);
}
}
}
}
foreach ($course_list as $courseId) {
// for each course in the session
$nbr_users = 0;
$courseId = Database::escape_string($courseId);
// delete existing users
if ($empty_users) {
foreach ($existingUsers as $existing_user) {
if (!in_array($existing_user, $user_list)) {
$sql = "DELETE FROM {$tbl_session_rel_course_rel_user} WHERE id_session='{$id_session}' AND c_id ='{$courseId}' AND id_user='{$existing_user}' AND status = 0";
$result = Database::query($sql);
if (Database::affected_rows($result)) {
$nbr_users--;
}
}
}
}
//Replace with this new function
//
// insert new users into session_rel_course_rel_user and ignore if they already exist
foreach ($user_list as $enreg_user) {
if (!in_array($enreg_user, $existingUsers)) {
$enreg_user = Database::escape_string($enreg_user);
$insert_sql = "INSERT IGNORE INTO {$tbl_session_rel_course_rel_user}(id_session, c_id, id_user, visibility, status) VALUES('{$id_session}','{$courseId}','{$enreg_user}','{$session_visibility}', '0')";
$result = Database::query($insert_sql);
if (Database::affected_rows($result)) {
$nbr_users++;
}
}
}
// count users in this session-course relation
$sql = "SELECT COUNT(id_user) as nbUsers FROM {$tbl_session_rel_course_rel_user} WHERE id_session='{$id_session}' AND c_id ='{$courseId}' AND status<>2";
$rs = Database::query($sql);
list($nbr_users) = Database::fetch_array($rs);
//.........这里部分代码省略.........
示例10: exportAllStudentWorkFromPublication
/**
* @param int $workId
* @param array $courseInfo
* @param int $sessionId
* @param string $format
* @return bool
*/
function exportAllStudentWorkFromPublication(
$workId,
$courseInfo,
$sessionId,
$format = 'pdf'
) {
if (empty($courseInfo)) {
return false;
}
$workData = get_work_data_by_id($workId);
if (empty($workData)) {
return false;
}
$assignment = get_work_assignment_by_id($workId);
$courseCode = $courseInfo['code'];
$header = get_lang('Course').': '.$courseInfo['title'];
$teachers = CourseManager::get_teacher_list_from_course_code_to_string(
$courseCode
);
if (!empty($sessionId)) {
$sessionInfo = api_get_session_info($sessionId);
if (!empty($sessionInfo)) {
$header .= ' - ' . $sessionInfo['name'];
$header .= '<br />' . $sessionInfo['description'];
$teachers = SessionManager::getCoachesByCourseSessionToString(
$sessionId,
$courseCode
);
}
}
$header .= '<br />'.get_lang('Teachers').': '.$teachers.'<br />';
$header .= '<br />'.get_lang('Date').': '.api_get_local_time().'<br />';
$header .= '<br />'.get_lang('StudentPublication').': '.$workData['title'].'<br />';
$content = null;
$expiresOn = null;
if (!empty($assignment) && isset($assignment['expires_on'])) {
$content .= '<br /><strong>' . get_lang('ExpiryDate') . '</strong>: ' . api_get_local_time($assignment['expires_on']);
$expiresOn = api_get_local_time($assignment['expires_on']);
}
if (!empty($workData['description'])) {
$content .= '<br /><strong>' . get_lang('Description') . '</strong>: ' . $workData['description'];
}
$workList = get_work_user_list(null, null, null, null, $workId);
switch ($format) {
case 'pdf':
if (!empty($workList)) {
require_once api_get_path(LIBRARY_PATH).'pdf.lib.php';
$table = new HTML_Table(array('class' => 'data_table'));
$headers = array(
get_lang('Name'),
get_lang('User'),
get_lang('HandOutDateLimit'),
get_lang('SentDate'),
get_lang('Filename'),
get_lang('Score'),
get_lang('Feedback')
);
$column = 0;
foreach($headers as $header) {
$table->setHeaderContents(0, $column, $header);
$column++;
}
$row = 1;
//$pdf->set_custom_header($header);
foreach ($workList as $work) {
$content .= '<hr />';
// getWorkComments need c_id
$work['c_id'] = $courseInfo['real_id'];
//$content .= get_lang('Date').': '.api_get_local_time($work['sent_date_from_db']).'<br />';
$score = null;
if (!empty($work['qualification_only'])) {
$score = $work['qualification_only'];
}
//$content .= get_lang('Description').': '.$work['description'].'<br />';
$comments = getWorkComments($work);
$feedback = null;
//.........这里部分代码省略.........
示例11: array
if ($id == 'name') {
$item2['text'] = $internal;
}
}
$results2[] = $item2;
}
$results2[] = array('T', 'text' => 'TODOS', 'id' => 'T');
echo json_encode($results2);
} else {
echo json_encode(array(array('T', 'text' => 'TODOS', 'id' => 'T')));
}
}
break;
case 'get_description':
if (isset($_GET['session'])) {
$sessionInfo = api_get_session_info($_GET['session']);
echo '<h2>' . $sessionInfo['name'] . '</h2>';
echo '<div class="home-course-intro"><div class="page-course"><div class="page-course-intro">';
echo $sessionInfo['show_description'] == 1 ? $sessionInfo['description'] : get_lang('None');
echo '</div></div></div>';
}
break;
case 'search_general_coach':
header('Content-Type: application/json');
if (api_is_anonymous()) {
echo '';
break;
}
$list = ['items' => []];
$entityManager = Database::getManager();
$usersRepo = $entityManager->getRepository('ChamiloUserBundle:User');
示例12: foreach
}
$sessionsByCourse = SessionManager::get_session_by_course($course['real_id']);
foreach ($sessionsByCourse as $session) {
$coaches = CourseManager::get_coachs_from_course($session['id'], $course['real_id']);
if ($coaches) {
foreach ($coaches as $coach) {
$totalTime = UserManager::getTimeSpentInCourses($coach['user_id'], $course['real_id'], $session['id'], $selectedFrom, $selectedUntil);
$formattedTime = api_format_time($totalTime);
$timeReport->data[] = array('session' => array('id' => $session['id'], 'name' => $session['name']), 'course' => array('id' => $course['real_id'], 'name' => $course['title']), 'coach' => array('userId' => $coach['user_id'], 'lastname' => $coach['lastname'], 'firstname' => $coach['firstname'], 'username' => $coach['username'], 'completeName' => api_get_person_name($coach['firstname'], $coach['lastname'])), 'totalTime' => $formattedTime);
}
}
}
}
if (!empty($selectedSession)) {
$withFilter = true;
$session = api_get_session_info($selectedSession);
$sessionData = array('id' => $session['id'], 'name' => $session['name']);
$reportTitle = sprintf(get_lang('TimeReportForSessionX'), $session['name']);
$courses = SessionManager::get_course_list_by_session_id($selectedSession);
foreach ($courses as $course) {
$courseData = array('id' => $course['id'], 'name' => $course['title']);
$coaches = CourseManager::get_coachs_from_course($selectedSession, $course['id']);
if ($coaches) {
foreach ($coaches as $coach) {
$totalTime = UserManager::getTimeSpentInCourses($coach['user_id'], $course['id'], $selectedSession, $selectedFrom, $selectedUntil);
$formattedTime = api_format_time($totalTime);
$timeReport->data[] = array('session' => $sessionData, 'course' => $courseData, 'coach' => array('userId' => $coach['user_id'], 'lastname' => $coach['lastname'], 'firstname' => $coach['firstname'], 'username' => $coach['username'], 'completeName' => api_get_person_name($coach['firstname'], $coach['lastname'])), 'totalTime' => $formattedTime);
}
}
}
}
示例13: transaction_10
static function transaction_10($data, $web_service_details)
{
$uidIdPrograma = $data['item_id'];
global $data_list;
$session_id = self::get_session_id_by_programa_id($uidIdPrograma, $data_list);
if (!empty($session_id)) {
$session_info = Migration::soap_call($web_service_details, 'programaDetalles', array('intIdSede' => $data['branch_id'], 'uididprograma' => $data['item_id']));
if ($session_info['error'] == false) {
self::fix_access_dates($session_info);
$session_info['id'] = $session_id;
unset($session_info['error']);
$session_info_before = api_get_session_info($session_id, true);
SessionManager::update($session_info);
$session_info = api_get_session_info($session_id, true);
return array('entity' => 'session', 'before' => $session_info_before, 'after' => $session_info, 'message' => "Session updated {$uidIdPrograma} with data: " . print_r($session_info, 1), 'status_id' => self::TRANSACTION_STATUS_SUCCESSFUL);
} else {
return $session_info;
}
} else {
return array('message' => "Session does not exists {$uidIdPrograma}", 'status_id' => self::TRANSACTION_STATUS_FAILED);
}
}
示例14: array
// Get validation hash
$hash = Security::remove_XSS($_REQUEST['v']);
// Get data from request (GET or POST)
$data['action'] = 'confirm';
$data['currentUserId'] = 1;
$data['queueId'] = 0;
$data['is_connected'] = true;
$data['profile_completed'] = 90.0;
// Init result array
$data['sessionId'] = 1;
$data['studentUserId'] = 4;
// Prepare data
// Get session data
// Assign variables
$fieldsArray = array('description', 'target', 'mode', 'publication_end_date', 'recommended_number_of_participants');
$sessionArray = api_get_session_info($data['sessionId']);
$extraSession = new ExtraFieldValue('session');
$extraField = new ExtraField('session');
// Get session fields
$fieldList = $extraField->get_all(array('variable IN ( ?, ?, ?, ?, ?)' => $fieldsArray));
$fields = array();
// Index session fields
foreach ($fieldList as $field) {
$fields[$field['id']] = $field['variable'];
}
$mergedArray = array_merge(array($data['sessionId']), array_keys($fields));
$sessionFieldValueList = $extraSession->get_all(array('item_id = ? field_id IN ( ?, ?, ?, ?, ?, ?, ? )' => $mergedArray));
foreach ($sessionFieldValueList as $sessionFieldValue) {
// Check if session field value is set in session field list
if (isset($fields[$sessionFieldValue['field_id']])) {
$var = $fields[$sessionFieldValue['field_id']];
示例15: GradebookTable
if (!empty($grade_models[$grade_model_id])) {
Display::display_normal_message(get_lang('GradeModel') . ': ' . $grade_models[$grade_model_id]['name']);
}
}
$exportToPdf = false;
if ($action == 'export_table') {
$exportToPdf = true;
}
$gradebooktable = new GradebookTable($cat, $allcat, $alleval, $alllink, $addparams, $exportToPdf);
if (api_is_allowed_to_edit()) {
$gradebooktable->td_attributes = [4 => 'class=centered'];
} else {
$gradebooktable->td_attributes = [3 => 'class=centered', 4 => 'class=centered', 5 => 'class=centered', 6 => 'class=centered', 7 => 'class=centered'];
}
$table = $gradebooktable->return_table();
$graph = $gradebooktable->getGraph();
if ($action == 'export_table') {
ob_clean();
$params = array('pdf_title' => get_lang('Report'), 'course_code' => api_get_course_id(), 'session_info' => api_get_session_info(api_get_session_id()), 'add_signatures' => false, 'student_info' => api_get_user_info());
$pdf = new PDF('A4', $params['orientation'], $params);
$pdf->html_to_pdf_with_template($table . $graph);
} else {
echo $table;
echo $graph;
}
}
}
}
}
api_set_in_gradebook();
Display::display_footer();