本文整理汇总了PHP中formatLogin函数的典型用法代码示例。如果您正苦于以下问题:PHP formatLogin函数的具体用法?PHP formatLogin怎么用?PHP formatLogin使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了formatLogin函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: handleForm
/**
* (non-PHPdoc)
* @see libraries/EfrontEntity#handleForm($form)
*/
public function handleForm($form)
{
formatLogin();
$flippedLogins = array_flip($GLOBALS['_usernames']);
$timestamp = mktime($_POST['payment_Hour'], $_POST['payment_Minute'], 0, $_POST['payment_Month'], $_POST['payment_Day'], $_POST['payment_Year']);
$values = $form->exportValues();
$fields = array("amount" => $values['amount'], "comments" => $values['comments'], "timestamp" => $timestamp, "txn_id" => $values['txn_id'], "method" => "manual", "users_LOGIN" => $flippedLogins[$_POST['user']]);
$payments = self::create($fields);
$this->payments = $payments;
}
开发者ID:bqq1986,项目名称:efront,代码行数:14,代码来源:payments.class.php
示例2: getConnectedUsers
function getConnectedUsers()
{
$usersOnline = array();
//A user may have multiple active entries on the user_times table, one for system, one for unit etc. Pick the most recent
$result = eF_getTableData("user_times,users,module_chat_users", "users_LOGIN, users.name, users.surname, users.user_type, timestamp_now, session_timestamp", "users.login=user_times.users_LOGIN and users.login=module_chat_users.username and session_expired=0", "timestamp_now desc");
foreach ($result as $value) {
if (!isset($parsedUsers[$value['users_LOGIN']])) {
$value['login'] = $value['users_LOGIN'];
$usersOnline[] = array('login' => $value['users_LOGIN'], 'formattedLogin' => formatLogin($value['login'], $value), 'user_type' => $value['user_type'], 'timestamp_now' => $value['timestamp_now'], 'time' => eF_convertIntervalToTime(time() - $value['session_timestamp']));
$parsedUsers[$value['users_LOGIN']] = true;
}
}
return $usersOnline;
}
开发者ID:kaseya-university,项目名称:efront,代码行数:14,代码来源:new-items.php
示例3: foreach
foreach ($assignedProjects[$id][$infoUser->user['login']] as $project) {
$workSheet->write($row, 0, $project['title'], $fieldCenterFormat);
$workSheet->write($row++, 1, formatScore($project['grade']) . "%", $fieldCenterFormat);
$avgScore += $project['grade'];
}
$workSheet->write($row, 0, _AVERAGESCORE, $titleCenterFormat);
$workSheet->write($row++, 1, formatScore($avgScore / sizeof($assignedProjects[$id][$infoUser->user['login']])) . "%", $titleCenterFormat);
}
}
}
$workBook->send('export_' . $infoUser->user['login'] . '.xls');
$workBook->close();
exit;
} else {
if (isset($_GET['pdf']) && $_GET['pdf'] == 'user') {
$pdf = new EfrontPdf(_REPORT . ": " . formatLogin($infoUser->user['login']));
try {
$avatarFile = new EfrontFile($infoUser->user['avatar']);
} catch (Exception $e) {
$avatarFile = new EfrontFile(G_SYSTEMAVATARSPATH . "unknown_small.png");
}
$info = array(array(_USERNAME, $userInfo['general']['fullname']), array(_USERTYPE, $userInfo['general']['user_types_ID'] ? $userInfo['general']['user_types_ID'] : $roles[$userInfo['general']['user_type']]), array(_ACTIVE, $userInfo['general']['active'] ? _YES : _NO), array(_JOINED, $userInfo['general']['joined_str']), array(_TOTALLOGINTIME, $userInfo['general']['total_login_time']['time_string']));
$pdf->printInformationSection(_GENERALUSERINFO, $info, $avatarFile);
$info = array(array(_FORUMPOSTS, sizeof($userInfo['communication']['forum_messages'])), array(_FORUMLASTMESSAGE, formatTimestamp($userInfo['communication']['last_message']['timestamp'])), array(_PERSONALMESSAGES, sizeof($userInfo['communication']['personal_messages'])), array(_MESSAGESFOLDERS, sizeof($userInfo['communication']['personal_folders'])), array(_FILES, sizeof($userInfo['communication']['files'])), array(_FOLDERS, sizeof($userInfo['communication']['folders'])), array(_TOTALSIZE, $userInfo['communication']['total_size'] . _KB), array(_COMMENTS, sizeof($userInfo['communication']['comments'])));
if (!EfrontUser::isOptionVisible('forum')) {
unset($info[_FORUMPOSTS]);
unset($info[_FORUMLASTMESSAGE]);
}
if (!EfrontUser::isOptionVisible('messages')) {
unset($info[_PERSONALMESSAGES]);
unset($info[_MESSAGESFOLDERS]);
开发者ID:jiangjunt,项目名称:efront_open_source,代码行数:31,代码来源:users_stats.php
示例4: isset
$sort = $_GET['sort'];
isset($_GET['order']) && $_GET['order'] == 'desc' ? $order = 'desc' : ($order = 'asc');
} else {
$sort = 'priority';
}
$smarty->assign("T_MESSAGES_SIZE", sizeof($folderMessages));
$folderMessages = eF_multiSort($folderMessages, $_GET['sort'], $order);
if (isset($_GET['filter'])) {
$folderMessages = eF_filterData($folderMessages, $_GET['filter']);
}
if (isset($_GET['limit']) && eF_checkParameter($_GET['limit'], 'int')) {
isset($_GET['offset']) && eF_checkParameter($_GET['offset'], 'int') ? $offset = $_GET['offset'] : ($offset = 0);
$folderMessages = array_slice($folderMessages, $offset, $limit);
}
foreach ($folderMessages as $key => $value) {
$recipients = explode(",", $folderMessages[$key]['recipient']);
foreach ($recipients as $k => $login) {
$recipients[$k] = formatLogin(trim($login));
}
$folderMessages[$key]['recipient'] = implode(", ", $recipients);
}
$smarty->assign("T_MESSAGES", $folderMessages);
//$smarty -> assign("T_MESSAGES_SIZE", sizeof($messages));
$smarty->display($currentUser->user['user_type'] . '.tpl');
exit;
}
}
}
} catch (Exception $e) {
handleNormalFlowExceptions($e);
}
开发者ID:kaseya-university,项目名称:efront,代码行数:31,代码来源:messages.php
示例5: getSmartyTpl
//.........这里部分代码省略.........
} else {
$workbookHTML .= '<div>' . $value['question_text'] . '</div>';
}
} else {
$workbookHTML .= '<div>' . $workbookAnswers[$value['id']] . '</div>';
}
}
$workbookHTML .= '</div><br/>';
}
$workbookHTML = preg_replace('/<script\\b[^>]*>(.*?)<\\/script>/is', "", $workbookHTML);
$fileName = _WORKBOOK_NAME . '_' . $this->getWorkbookLessonName($currentLessonID);
$fileName = preg_replace('/[\\s]+/', '_', $fileName);
$htmltodoc = new HTML_TO_DOC();
$htmltodoc->createDoc($workbookHTML, $fileName, true);
exit(0);
}
if (isset($_GET['download_as']) && $_GET['download_as'] == 'pdf') {
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true);
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor(PDF_AUTHOR);
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
$pdf->setFontSubsetting(false);
$pdf->AddPage();
$completion_date = '';
$resutlt = eF_getTableData('module_workbook_progress', 'completion_date', "users_LOGIN='" . $currentUser->user['login'] . "' and lessons_ID='" . $currentLessonID . "'");
if ($resutlt) {
$completion_date = $resutlt[0]['completion_date'];
}
$workbookHTML = '';
$workbookHTML .= '<table>';
$workbookHTML .= '<tr>';
$workbookHTML .= '<td colspan="2">';
$workbookHTML .= formatLogin($currentUser->user['login']);
$workbookHTML .= '</td>';
$workbookHTML .= '</tr>';
$workbookHTML .= '<tr>';
$workbookHTML .= '<td>';
$workbookHTML .= $workbookLessonName;
$workbookHTML .= '</td>';
$workbookHTML .= '<td>';
$workbookHTML .= formatTimestamp($completion_date);
$workbookHTML .= '</td>';
$workbookHTML .= '</tr>';
$workbookHTML .= '</table>';
$pdf->writeHTML($workbookHTML, true, false, true, false, '');
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->setHeaderFont(array('Freeserif', 'I', 11));
$pdf->setFooterFont(array('Freeserif', '', 8));
$pdf->setHeaderData('', '', '', $workbookLessonName);
$pdf->AliasNbPages();
$pdf->SetFont('Freeserif', '', 10);
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('Freeserif', '', 10);
$pdf->SetTextColor(0, 0, 0);
$workbookAnswers = $this->getWorkbookAnswers($currentUser->user['login'], array_keys($workbookItems));
$pdf->AddPage();
$workbookHTML .= '';
$itemLogo = new EfrontFile(G_DEFAULTIMAGESPATH . "32x32/unit.png");
$itemLogoUrl = $itemLogo['path'];
foreach ($workbookItems as $key => $value) {
$workbookHTML .= '<div id="pdf-block" style="width:98%;float:left;border:1px dotted #808080;page-break-after:always;">';
$workbookHTML .= '<div style="background-color: #EAEAEA;font-weight: bold;">';
$workbookHTML .= '<img src="' . $itemLogoUrl . '"/> ' . _WORKBOOK_ITEMS_COUNT . $value['position'];
if ($value['item_title'] != '') {
开发者ID:kaseya-university,项目名称:efront,代码行数:67,代码来源:module_workbook.class.php
示例6: foreach
foreach ($result as $value) {
$userBranches[$value['users_login']][] = $value['name'];
}
foreach ($userBranches as $login => $value) {
$userBranches[$login] = implode(",", $value);
}
$formatting = array(_USER => array('width' => '16%', 'fill' => false), _COURSEROLE => array('width' => '16%', 'fill' => false), _BRANCH => array('width' => '16%', 'fill' => false), _PERCENTAGE => array('width' => '16%', 'fill' => false), _ENROLLEDON => array('width' => '10%', 'fill' => false), _COMPLETED => array('width' => '11%', 'fill' => false), _SCORE => array('width' => '11%', 'fill' => false, 'align' => 'R'));
}
#cpp#endif
foreach ($users as $login => $info) {
if ($info['completed'] && $info['to_timestamp']) {
$completedString = _YES . ', ' . _ON . ' ' . formatTimestamp($info['to_timestamp']);
} elseif ($info['completed']) {
$completedString = _YES;
} else {
$completedString = _NO;
}
if (G_VERSIONTYPE == 'enterprise') {
#cpp#ifdef ENTERPRISE
$data[] = array(_USER => formatLogin($info['login']), _COURSEROLE => $roles[$info['role']], _BRANCH => $userBranches[$login], _PERCENTAGE => $rolesBasic[$info['user_type']] == 'student' ? $info['lesson_percentage'] . "%" : "", _ENROLLEDON => formatTimestamp($info['enrolled_on']), _COMPLETED => $completedString, _SCORE => formatScore($info['score']) . "%");
} else {
#cpp#else
$data[] = array(_USER => formatLogin($info['login']), _COURSEROLE => $roles[$info['role']], _PERCENTAGE => $rolesBasic[$info['user_type']] == 'student' ? $info['lesson_percentage'] . "%" : "", _ENROLLEDON => formatTimestamp($info['enrolled_on']), _COMPLETED => $completedString, _SCORE => formatScore($info['score']) . "%");
}
#cpp#endif
}
$pdf->printDataSection(_USERSINFO, $data, $formatting);
$pdf->OutputPdf('course_form_' . $infoCourse->course['name'] . '.pdf');
exit;
}
}
开发者ID:kaseya-university,项目名称:efront,代码行数:31,代码来源:courses_stats.php
示例7: createCourseMetadata
/**
* Create course metadata
*
* @param array $fields Course properties
* @return string Serialized representation of metadata array
* @since 3.6.1
* @access private
*/
private static function createCourseMetadata($fields)
{
$languages = EfrontSystem::getLanguages(true);
$courseMetadata = array('title' => $fields['name'], 'creator' => formatLogin($GLOBALS['currentUser']->user['login']), 'publisher' => formatLogin($GLOBALS['currentUser']->user['login']), 'contributor' => formatLogin($GLOBALS['currentUser']->user['login']), 'date' => date("Y/m/d", time()), 'language' => $languages[$fields['languages_NAME']], 'type' => 'course');
$metadata = serialize($courseMetadata);
return $metadata;
}
开发者ID:kaseya-university,项目名称:efront,代码行数:15,代码来源:course.class.php
示例8: doCategoryReports
//.........这里部分代码省略.........
$branchesPaths = $branchesTree->toPathString();
$category = new EfrontDirection($_SESSION['category']);
$directionsTree = new EfrontDirectionsTree();
$children = $directionsTree->getNodeChildren($_SESSION['category']);
foreach (new EfrontAttributeFilterIterator(new RecursiveIteratorIterator(new RecursiveArrayIterator($children)), array('id')) as $value) {
$siblings[] = $value;
}
$result = eF_getTableDataFlat("courses", "id", "archive = 0 && directions_ID in (" . implode(",", $siblings) . ")");
$categoryCourses = $result['id'];
$resultCourses = eF_getTableDataFlat("users_to_courses uc, courses c", "distinct c.id", 'c.id=uc.courses_ID ' . (!$_SESSION['inactive'] ? 'and c.active=1' : '') . ' and uc.archive=0 and uc.completed=1 and uc.to_timestamp >= ' . $_SESSION['from_timestamp'] . ' and uc.to_timestamp <= ' . $_SESSION['to_timestamp']);
$resultEvents = eF_getTableDataFlat("events e, courses c", "distinct c.id", 'c.id=e.lessons_ID ' . (!$_SESSION['inactive'] ? 'and c.active=1' : '') . ' and e.type=54 and e.timestamp >= ' . $_SESSION['from_timestamp'] . ' and e.timestamp <= ' . $_SESSION['to_timestamp']);
if (empty($resultEvents)) {
$resultEvents['id'] = array();
}
$result = array_unique(array_merge($resultCourses['id'], $resultEvents['id']));
$categoryCourses = array_intersect(array_unique($categoryCourses), $result);
//count only courses that have users completed them
if ($_SESSION['incomplete']) {
$constraints = array('archive' => false, 'condition' => '(to_timestamp is null OR to_timestamp = 0 OR (to_timestamp >= ' . $_SESSION['from_timestamp'] . ' and to_timestamp <= ' . $_SESSION['to_timestamp'] . '))');
} else {
$constraints = array('archive' => false, 'condition' => 'completed=1 and to_timestamp >= ' . $_SESSION['from_timestamp'] . ' and to_timestamp <= ' . $_SESSION['to_timestamp']);
}
foreach ($categoryCourses as $courseId) {
$course = new EfrontCourse($courseId);
foreach ($course->getCourseUsers($constraints) as $value) {
$userBranches = $value->aspects['hcd']->getBranches();
$userSupervisors = $value->aspects['hcd']->getSupervisors();
$userSupervisor = end($userSupervisors);
$value->user['course_active'] = $course->course['active'];
$value->user['course_id'] = $course->course['id'];
$value->user['category'] = $directionPaths[$course->course['directions_ID']];
$value->user['course'] = $course->course['name'];
$value->user['directions_ID'] = $course->course['directions_ID'];
$value->user['branch'] = $branchesPaths[current($userBranches['employee'])];
$value->user['branch_ID'] = current($userBranches['employee']);
$value->user['supervisor'] = $userSupervisor;
$value->user['historic'] = false;
$unique = md5($value->user['to_timestamp'] . $value->user['course_id'] . $value->user['login']);
$courseUsers[$unique] = $value->user;
}
$result = eF_getTableData("events", "*", 'type=54 and lessons_ID=' . $courseId . ' and timestamp >= ' . $_SESSION['from_timestamp'] . ' and timestamp <= ' . $_SESSION['to_timestamp']);
//exit;
foreach ($result as $entry) {
try {
$value = EfrontUserFactory::factory($entry['users_LOGIN']);
if (!$value->user['archive']) {
$userBranches = $value->aspects['hcd']->getBranches();
$userSupervisors = $value->aspects['hcd']->getSupervisors();
//pr($entry['users_LOGIN']);pr($userSupervisors);pr(current($userSupervisors));
$userSupervisor = current($userSupervisors);
$value->user['course_active'] = $course->course['active'];
$value->user['course_id'] = $course->course['id'];
$value->user['category'] = $directionPaths[$course->course['directions_ID']];
$value->user['course'] = $course->course['name'];
$value->user['directions_ID'] = $course->course['directions_ID'];
$value->user['branch'] = $branchesPaths[current($userBranches['employee'])];
$value->user['branch_ID'] = current($userBranches['employee']);
$value->user['supervisor'] = $userSupervisor;
$value->user['to_timestamp'] = $entry['timestamp'];
$value->user['completed'] = 1;
$value->user['score'] = '';
$value->user['historic'] = true;
$unique = md5($value->user['to_timestamp'] . $value->user['course_id'] . $value->user['login']);
if (!isset($courseUsers[$unique])) {
$courseUsers[$unique] = $value->user;
}
}
} catch (Exception $e) {
/*Bypass non-existing users*/
}
}
}
if ($_GET['ajax'] == 'xls') {
$xlsFilePath = $currentUser->getDirectory() . 'category_report.xls';
unlink($xlsFilePath);
$_GET['limit'] = sizeof($courseUsers);
$_GET['sort'] = 'category';
list($tableSize, $courseUsers) = filterSortPage($courseUsers);
$header = array('category' => _CATEGORY, 'course' => _NAME, 'login' => _USER, 'to_timestamp' => _COMPLETED, 'score' => _SCORE, 'supervisor' => _SUPERVISOR, 'branch' => _BRANCH, 'historic' => _MODULE_ADMINISTRATOR_TOOLS_HISTORICENTRY);
foreach ($courseUsers as $value) {
$rows[] = array(_CATEGORY => str_replace(" → ", " -> ", $value['category']), _COURSE => $value['course'], _USER => formatLogin($value['login']), _COMPLETED => formatTimestamp($value['to_timestamp']), _SCORE => $value['historic'] ? '' : formatScore($value['score']) . '%', _SUPERVISOR => formatLogin($value['supervisor']), _BRANCH => str_replace(" → ", " -> ", $value['branch']), _MODULE_ADMINISTRATOR_TOOLS_HISTORICENTRY => $value['historic'] ? _YES : _NO);
}
EfrontSystem::exportToXls($rows, $xlsFilePath);
exit;
} else {
if ($_GET['ajax'] == 'show_xls') {
$xlsFilePath = $currentUser->getDirectory() . 'category_report.xls';
$file = new EfrontFile($xlsFilePath);
$file->sendFile(true);
exit;
} else {
list($tableSize, $courseUsers) = filterSortPage($courseUsers);
$smarty->assign("T_SORTED_TABLE", $_GET['ajax']);
$smarty->assign("T_TABLE_SIZE", $tableSize);
$smarty->assign("T_DATA_SOURCE", $courseUsers);
}
}
}
$smarty->assign("T_CATEGORY_FORM", $form->toArray());
}
开发者ID:kaseya-university,项目名称:efront,代码行数:101,代码来源:module_administrator_tools.class.php
示例9: onResetProgressInAllCourses
/**
* (non-PHPdoc)
* @see libraries/EfrontModule#onResetProgressInCourse($login)
*/
public function onResetProgressInAllCourses($login)
{
$courseName = eF_getTableData("courses", "name", "id={$courseId}");
eF_insertTableData("module_vLab_data", array("timestamp" => time(), "data" => str_replace('%login%', formatLogin($login), _MODULE_VLAB_RESETALLCOURSE)));
}
开发者ID:kaseya-university,项目名称:efront,代码行数:9,代码来源:module_vLab.class.php
示例10: printPdfHeader
private function printPdfHeader($title)
{
$this->pdf->SetCreator(formatLogin($_SESSION['s_login']));
$this->pdf->SetAuthor(formatLogin($_SESSION['s_login']));
$this->pdf->SetTitle($title);
//$this->pdf->SetSubject($title);
//$this->pdf->SetKeywords('pdf, '._EMPLOYEEFORM);
$this->pdf->setPrintHeader(false);
$this->pdf->setPrintFooter(false);
$this->pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
$this->pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
$this->pdf->setFontSubsetting(false);
$this->pdf->AddPage();
$logoFile = EfrontSystem::getSystemLogo();
$imgDetails = getimagesize($logoFile['path']);
if ($imgDetails[0] > 170) {
$resized_file = $logoFile['directory'] . '/resized-logo.png';
$this->smartResizeImage($logoFile['path'], null, '170', '52', true, $resized_file, false, false, 100);
$resized = true;
}
if (extension_loaded('gd')) {
if ($resized) {
$this->pdf->Image($resized_file, '', '', 0, 0, '', '', 'T');
} else {
$this->pdf->Image($logoFile['path'], '', '', 0, 0, '', '', 'T');
}
}
$this->pdf->SetFont($this->defaultSettings['default_font']);
$this->printLargeTitle($GLOBALS['configuration']['site_name']);
$this->printSmallTitle($GLOBALS['configuration']['site_motto']);
$this->printSeparatorHeader($title);
}
开发者ID:jiangjunt,项目名称:efront_open_source,代码行数:32,代码来源:pdf.class.php
示例11: getModule
/**
* The main functionality
*
* (non-PHPdoc)
* @see libraries/EfrontModule#getModule()
*/
public function getModule()
{
$smarty = $this->getSmartyVar();
$smarty->assign("T_MODULE_BASEDIR", $this->moduleBaseDir);
$smarty->assign("T_MODULE_BASELINK", $this->moduleBaseLink);
$smarty->assign("T_MODULE_BASEURL", $this->moduleBaseUrl);
$currentUser = $this->getCurrentUser();
if ($currentUser->user['user_type'] != 'administrator') {
$currentEmployee = $this->getCurrentUser()->aspects['hcd'];
if (!$currentEmployee || !$currentEmployee->isSupervisor()) {
throw new Exception("You cannot access this module");
}
}
$form = new HTML_QuickForm("user_activity_form", "post", basename($_SERVER['PHP_SELF']) . "?ctg=module&op=module_idle_users&tab=user_activity", "", null, true);
$form->addElement('date', 'idle_from_timestamp', _MODULE_IDLE_USERS_SHOWINACTIVEUSERSSINCE, array('minYear' => 2005, 'maxYear' => date("Y")));
$form->addElement("static", "", '<a href = "javascript:void(0)" onclick = "setFormDate(' . date("Y") . ',' . date("m") . ',' . (date("d") - 7) . ')">' . _LASTWEEK . '</a> - <a href = "javascript:void(0)" onclick = "setFormDate(' . date("Y") . ',' . (date("m") - 1) . ',' . date("d") . ')">' . _LASTMONTH . '</a> - <a href = "javascript:void(0)" onclick = "setFormDate(' . date("Y") . ',' . (date("m") - 3) . ',' . date("d") . ')">' . _MODULE_IDLE_USERS_LAST3MONTHS . '</a>');
$form->addElement("submit", "submit", _SUBMIT, 'class = "flatButton"');
if (!isset($_SESSION['timestamp_from'])) {
$_SESSION['timestamp_from'] = time() - 86400 * 30;
}
$form->setDefaults(array("idle_from_timestamp" => $_SESSION['timestamp_from']));
if ($form->isSubmitted() && $form->validate()) {
$values = $form->exportValues();
$_SESSION['timestamp_from'] = mktime(0, 0, 0, $values['idle_from_timestamp']['M'], $values['idle_from_timestamp']['d'], $values['idle_from_timestamp']['Y']);
}
$smarty->assign("T_IDLE_USER_FORM", $form->toArray());
try {
if ($currentEmployee) {
if ($_SESSION['s_current_branch'] && in_array($_SESSION['s_current_branch'], $currentEmployee->supervisesBranches)) {
$currentBranch = new EfrontBranch($_SESSION['s_current_branch']);
$subbranches = $currentBranch->getSubbranches();
foreach ($subbranches as $subbranch) {
$branches[$subbranch['branch_ID']] = $subbranch['branch_ID'];
}
$branches[$_SESSION['s_current_branch']] = $_SESSION['s_current_branch'];
$result = eF_getTableData("users u JOIN module_hcd_employee_works_at_branch ewb on ewb.users_login=u.login", "u.login,u.name,u.surname,u.active,u.last_login as last_action", "ewb.branch_ID in (" . implode(',', $branches) . ") and u.last_login is null or u.last_login <= " . $_SESSION['timestamp_from']);
//$result = eF_getTableData("(select login,name,surname,active,max(l.timestamp) as last_action from users u left outer join logs l on u.login=l.users_LOGIN where u.archive=0 group by login) r join module_hcd_employee_works_at_branch ewb on ewb.users_login=r.login", "*", "ewb.branch_ID in (".implode(',', $branches) .") and (r.last_action is null or r.last_action <= ".$_SESSION['timestamp_from'].")");
} else {
$result = eF_getTableData("users u JOIN module_hcd_employee_works_at_branch ewb on ewb.users_login=u.login", "u.login,u.name,u.surname,u.active,u.last_login as last_action", "ewb.branch_ID in (" . implode(',', $currentEmployee->supervisesBranches) . ") and u.last_login is null or u.last_login <= " . $_SESSION['timestamp_from']);
//$result = eF_getTableData("(select login,name,surname,active,max(l.timestamp) as last_action from users u left outer join logs l on u.login=l.users_LOGIN where u.archive=0 group by login) r join module_hcd_employee_works_at_branch ewb on ewb.users_login=r.login", "*", "ewb.branch_ID in (".implode(',', $currentEmployee->supervisesBranches).") and (r.last_action is null or r.last_action <= ".$_SESSION['timestamp_from'].")");
}
} else {
$result = eF_getTableData("users", "login,name,surname,active,last_login as last_action", "last_login is null or last_login <= " . $_SESSION['timestamp_from']);
}
$users = array();
foreach ($result as $value) {
if ($value['last_action']) {
$value['last_action_since'] = eF_convertIntervalToTime(time() - $value['last_action'], true);
} else {
$value['last_action_since'] = null;
}
$users[$value['login']] = $value;
}
foreach ($users as $key => $value) {
if (isset($_COOKIE['toggle_active'])) {
if ($_COOKIE['toggle_active'] == 1 && !$value['active'] || $_COOKIE['toggle_active'] == -1 && $value['active']) {
unset($users[$key]);
}
}
}
if (isset($_GET['excel'])) {
$export_users[] = array(_USER, _MODULE_IDLE_USERS_LASTACTION, _STATUS);
foreach ($users as $key => $value) {
$value['last_action'] ? $last_action = formatTimestamp($value['last_action']) : ($last_action = _NEVER);
$value['active'] ? $status = _ACTIVE : ($status = _INACTIVE);
$export_users[] = array(formatLogin($value['login']), $last_action, $status);
}
EfrontSystem::exportToCsv($export_users, true);
exit;
}
if ($_GET['ajax'] == 'idleUsersTable') {
list($tableSize, $users) = filterSortPage($users);
$smarty->assign("T_SORTED_TABLE", $_GET['ajax']);
$smarty->assign("T_TABLE_SIZE", $tableSize);
$smarty->assign("T_DATA_SOURCE", $users);
}
if (isset($_GET['ajax']) && isset($_GET['archive_user'])) {
if (isset($users[$_GET['archive_user']])) {
$user = EfrontUserFactory::factory($_GET['archive_user']);
$user->archive();
}
exit;
} else {
if (isset($_GET['ajax']) && isset($_GET['archive_all_users'])) {
//eF_updateTableData("users", array("archive" => 1, "active" => 0), "login in (select login from (select login,max(l.timestamp) as last_action from users u left outer join logs l on u.login=l.users_LOGIN where u.archive=0 and u.login != '".$_SESSION['s_login']."' group by login) r where r.last_action <= ".$_SESSION['timestamp_from']." or r.last_action is null)");
foreach ($users as $value) {
eF_updateTableData("users", array("archive" => 1, "active" => 0), "login='" . $value['login'] . "'");
}
exit;
} else {
if (isset($_GET['ajax']) && isset($_GET['toggle_user'])) {
if (isset($users[$_GET['toggle_user']])) {
$user = EfrontUserFactory::factory($_GET['toggle_user']);
if ($user->user['active']) {
//.........这里部分代码省略.........
开发者ID:bqq1986,项目名称:efront,代码行数:101,代码来源:module_idle_users.class.php
示例12: handleForm
/**
* (non-PHPdoc)
* @see libraries/EfrontEntity#handleForm($form)
*/
public function handleForm($form)
{
$values = $form->exportValues();
$forumUser = EfrontUserFactory::factory($_SESSION['s_login']);
$forumAttachmentDirectory = $forumUser->getDirectory() . 'forum';
if (!is_dir($forumAttachmentDirectory)) {
mkdir($forumAttachmentDirectory, 0755);
}
$filesystem = new FileSystemTree($forumAttachmentDirectory);
$attachmentBody = '';
foreach ($_FILES['attachment_upload']['error'] as $key => $value) {
if ($value != UPLOAD_ERR_NO_FILE) {
$uploadedFile = $filesystem->uploadFile('attachment_upload', $certificateDirectory, $key);
$attachmentid = $uploadedFile['id'];
$attachmentBody .= '<p style="font-style:italic"><a href="view_file.php?action=download&file=' . $attachmentid . '">' . $uploadedFile['name'] . '</a></p>';
}
}
if (isset($_GET['edit'])) {
$fields = array("title" => $values['title'], "body" => $values['body'] . $attachmentBody);
if ($this->{$this->entity}['users_LOGIN'] != $_SESSION['s_login'] && strstr($fields['body'], _FORUMMESSAGEEDITEDBY . " " . formatLogin($_SESSION['s_login'])) === false) {
$fields['body'] .= " " . _FORUMMESSAGEEDITEDBY . " " . formatLogin($_SESSION['s_login']) . " (" . formatTimestamp(time()) . ")";
}
$this->{$this->entity} = array_merge($this->{$this->entity}, $fields);
$this->persist();
} else {
$fields = array("title" => $values['title'], "body" => $values['body'] . $attachmentBody, "f_topics_ID" => $_GET['topic_id'], "users_LOGIN" => $_SESSION['s_login'], "timestamp" => time(), "replyto" => $values['replyto'] ? $values['replyto'] : 0);
self::create($fields);
}
}
开发者ID:jiangjunt,项目名称:efront_open_source,代码行数:33,代码来源:forum.class.php
示例13: toHTML
//.........这里部分代码省略.........
}
$filesCode .= '<tr class = "defaultRowHeight ' . (fmod($i++, 2) ? 'oddRowColor' : 'evenRowColor') . '">';
if ($options['show_type']) {
$filesCode .= '<td class = "centerAlign"><span style = "display:none">' . (isset($value['extension']) ? $value['extension'] : '') . '</span>';
if ($value['type'] == 'file') {
if (strpos($value['mime_type'], "image") !== false || strpos($value['mime_type'], "text") !== false || strpos($value['mime_type'], "pdf") !== false || strpos($value['mime_type'], "html") !== false || strpos($value['mime_type'], "video") !== false || strpos($value['mime_type'], "flash") !== false) {
$filesCode .= '<a href = "javascript:void(0);" onclick = "eF_js_showDivPopup(event, \'' . _PREVIEW . '\', 2, \'preview_table_' . $tableId . '\');$(\'preview_frame\').src = \'' . $link . '\';" ><img src = "' . $value->getTypeImage() . '" alt = "' . $value['mime_type'] . '" title = "' . $value['mime_type'] . '" border = "0"/></a></td>';
} else {
$filesCode .= '<a href = "' . $url . '&download=' . urlencode($identifier) . '"><img src = "' . $value->getTypeImage() . '" alt = "' . $value['mime_type'] . '" title = "' . $value['mime_type'] . '" border = "0"/></a>';
}
} else {
isset($value['mime_type']) ? $mimeType = $value['mime_type'] : ($mimeType = '');
$filesCode .= '<img src = "' . $value->getTypeImage() . '" alt = "' . $mimeType . '" title = "' . $mimeType . '" border = "0"/></td>';
}
}
if ($options['show_name']) {
$filesCode .= '<td><span id = "span_' . urlencode($identifier) . '" style = "display:none;">' . urlencode($identifier) . '</span>';
if ($value['type'] == 'file') {
if ($show_tooltip) {
$filesCode .= $value->toHTMLTooltipLink($link, true, $tableId);
} else {
if (strpos($value['mime_type'], "image") !== false || strpos($value['mime_type'], "text") !== false || strpos($value['mime_type'], "pdf") !== false || strpos($value['mime_type'], "flash") !== false || strpos($value['mime_type'], "video") !== false) {
$filesCode .= '<a href = "javascript:void(0);" onclick = "eF_js_showDivPopup(event, \'' . _PREVIEW . '\', 2, \'preview_table_' . $tableId . '\');$(\'preview_frame\').src = \'' . $link . '\';" >' . $value['name'] . '</a>';
} else {
$filesCode .= '<a target = "PREVIEW_FRAME" href = "' . $url . '&download=' . urlencode($identifier) . '">' . $value['name'] . '</a>';
}
}
} else {
$filesCode .= '<a class="editLink" href = "javascript:void(0)" onclick = "eF_js_rebuildTable($(\'filename_' . $tableId . '\').down().getAttribute(\'tableIndex\'), 0, \'\', \'desc\', \'' . urlencode($identifier) . '\');">' . $value['name'] . '</a>';
}
$filesCode .= '<span id = "edit_' . urlencode($identifier) . '" style = "display:none"><input type = "text" value = "' . $value['name'] . '" onkeypress = "if (event.which == 13 || event.keyCode == 13) {Element.extend(this).next().down().onclick(); return false;}"/> <a href = "javascript:void(0)"><img id = "editImage_' . urlencode($identifier) . '"src = "images/16x16/success.png" style = "vertical-align:middle" onclick = "editFile(this, $(\'span_' . urlencode($identifier) . '\').innerHTML, Element.extend(this).up().previous().value, \'' . $value['type'] . '\',\'' . eF_addslashes($value['name']) . '\')" border = "0"></a></span></td>';
}
if ($options['show_owner']) {
$filesCode .= '<td class = "centerAlign"><span>' . (isset($value['users_LOGIN']) ? formatLogin($value['users_LOGIN']) : '') . '</span></td>';
}
$extraColumnsString = '';
foreach ($extraColumns as $column) {
$extraColumnsString = '<td class = "centerAlign">' . $value[$column] . '</td>';
}
$filesCode .= '' . ($options['show_size'] ? '<td>' . ($value['type'] == 'file' ? $value['size'] . ' ' . _KB : '') . '</td>' : '') . '
' . ($options['show_date'] ? '<td>' . formatTimestamp($value['timestamp'], 'time_nosec') . '</td>' : '') . '
' . $extraColumnsString . '
' . ($_SESSION['s_lessons_ID'] && $options['share'] ? '<td class = "centerAlign">' . $sharedString . '</td>' : '') . '
' . ($options['show_tools'] ? '<td class = "centerAlign">' . $toolsString . '</td>' : '') . '
' . ($options['delete'] || $options['copy'] || $_SESSION['s_lessons_ID'] && $options['share'] ? '<td class = "centerAlign">' . ($value['type'] == 'file' ? '<input type = "checkbox" id = "' . $identifier . '" value = "' . $identifier . '" />' : '') . '</td>' : '') . '
</tr>';
}
$massOperationsCode = '';
if ($size) {
$filesCode .= '
</table>';
if ($options['delete'] || $options['copy'] || $_SESSION['s_lessons_ID'] && $options['share']) {
$massOperationsCode = '
<div class = "horizontalSeparatorAbove">
<span style = "vertical-align:middle">' . _WITHSELECTEDFILES . ':</span>
' . ($_SESSION['s_lessons_ID'] && $options['share'] ? '<a href = "javascript:void(0)"><img src = "images/16x16/trafficlight_green.png" title = "' . _SHARESELECTED . '" alt = "' . _SHARESELECTED . '" border = "0" style = "vertical-align:middle" onclick = "shareSelected()"></a><a href = "javascript:void(0)"><img src = "images/16x16/trafficlight_red.png" title = "' . _UNSHARESELECTED . '" alt = "' . _UNSHARESELECTED . '" border = "0" style = "vertical-align:middle" onclick = "unshareSelected()"></a>' : '');
if ($options['copy']) {
$massOperationsCode .= '
<form name = "copy_files_form" id = "copy_files_form" method = "post" style = "display:none;"><input type = "hidden" name = "copy_current_directory" id = "copy_current_directory"><input type = "hidden" name = "copy_files" id = "copy_files" value = "" /></form>
<img class = "ajaxHandle" src = "images/16x16/copy.png" title = "' . _COPYSELECTED . '" alt = "' . _COPYSELECTED . '" onclick = "copyFiles(this);">
<img style = "display:none" class = "ajaxHandle" src = "images/16x16/paste.png" title = "' . _PASTESELECTED . '" alt = "' . _PASTESELECTED . '" onclick = "pasteFiles(this, \'' . $tableId . '\');"> ';
}
$massOperationsCode .= ($options['delete'] ? '<a href = "javascript:void(0)"><img src = "images/16x16/error_delete.png" title = "' . _DELETESELECTED . '" alt = "' . _DELETESELECTED . '" border = "0" style = "vertical-align:middle" onclick = "if (confirm(\'' . _IRREVERSIBLEACTIONAREYOUSURE . '\')) deleteSelected()"></a>' : '') . '
</div>';
}
} elseif (!isset($parentDir)) {
开发者ID:jiangjunt,项目名称:efront_open_source,代码行数:67,代码来源:filesystem.class.php
示例14: createMessage
/**
* Get event message
*
* This function creates the message string for this event
* according to its type and its information
*
* <br/>Example:
* <code>
* $event = new EfrontEvent(5); //create object for event with id 5
* $event -> createMessage();
* echo $event -> event['message'];
* </code>
*
* @param array with all modules to optimize module message printing
* @returns the message value also set to the $this -> event['message'] field
* @since 3.6.0
* @access public
*/
public function createMessage($modulesArray = false)
{
global $currentUser;
// Module related code
if ($this->event['type'] >= EfrontEvent::MODULE_BASE_TYPE_CODE) {
$className = $this->event['entity_ID'];
if (isset($modulesArray[$className])) {
$data = array();
if ($this->event['entity_name'] != '') {
$data = unserialize($this->event['entity_name']);
}
foreach ($this->event as $field => $value) {
$data[$field] = $value;
}
$this->event['message'] = $modulesArray[$className]->getEventMessage((int) $this->event['type'] - EfrontEvent::MODULE_BASE_TYPE_CODE, $data);
}
if (!$this->event['message']) {
$this->event['message'] = _UNREGISTEREDEVENT . " " . _FORTHEMODULE . " '" . $className . "'";
}
} else {
// Basic system event codes
// All excluded events are not of the form: The user did sth. For example: Project X expired
if ($this->event['type'] != EfrontEvent::PROJECT_EXPIRY && $this->event['type'] != EfrontEvent::LESSON_PROGRAMMED_EXPIRY && $this->event['type'] != EfrontEvent::LESSON_PROGRAMMED_START) {
//changed to $_SESSION['s_type'] to work for different roles between lessons
formatLogin($this->event['users_LOGIN']) ? $formattedLogin = formatLogin($this->event['users_LOGIN']) : ($formattedLogin = $this->event['users_name'] . ' ' . $this->event['users_surname'] . ' (' . $this->event['users_LOGIN'] . ')');
$this->event['message'] = _NAMEARTICLE . " <b><a href = \"" . $_SESSION['s_type'] . ".php?ctg=social&op=show_profile&user=" . $this->event['users_LOGIN'] . "&popup=1\" onclick = \"eF_js_showDivPopup(event, '" . _USERPROFILE . "', 1)\" target = \"POPUP_FRAME\"> " . $formattedLogin . "</a></b> ";
}
if ($this->event['type'] == EfrontEvent::SYSTEM_JOIN) {
$this->event['message'] .= _HASJOINEDTHESYSTEM;
|
请发表评论