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


PHP handleAjaxExceptions函数代码示例

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


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

示例1: catch

                 exit;
             } catch (Exception $e) {
                 handleAjaxExceptions($e);
             }
         } elseif (isset($_GET['ajax']) && $_GET['ajax'] == 'cancel') {
             try {
                 if (eF_checkParameter($_GET['course_id'], 'id')) {
                     $course = new EfrontCourse($_GET['course_id']);
                     $course->removeUsers($_GET['users_login']);
                     $event = array("type" => EfrontEvent::COURSE_USER_REFUSAL, "users_LOGIN" => $_GET['users_login'], "lessons_ID" => $course->course['id'], "lessons_name" => $course->course['name']);
                     EfrontEvent::triggerEvent($event);
                     echo json_encode(array('status' => 1));
                     exit;
                 }
             } catch (Exception $e) {
                 handleAjaxExceptions($e);
             }
         }
     }
 }
 #cpp#endif
 if ($currentUser->coreAccess['dashboard'] != 'hidden') {
     $myCoursesOptions[] = array('text' => _DASHBOARD, 'image' => "32x32/user.png", 'href' => basename($_SERVER['PHP_SELF']) . "?ctg=personal");
 }
 $constraints = array('archive' => false, 'active' => true, 'sort' => 'name');
 $userCourses = $currentUser->getUserCourses($constraints);
 foreach ($userCourses as $key => $course) {
     if ($course->course['start_date'] && $course->course['start_date'] > time()) {
         $course->course['remaining'] = null;
     } elseif ($course->course['end_date'] && $course->course['end_date'] < time()) {
         $course->course['remaining'] = 0;
开发者ID:bqq1986,项目名称:efront,代码行数:31,代码来源:lessons_list.php

示例2: getSmartyTpl

 public function getSmartyTpl()
 {
     $smarty = $this->getSmartyVar();
     $smarty->assign("T_RSS_MODULE_BASEURL", $this->moduleBaseUrl);
     $smarty->assign("T_RSS_MODULE_BASELINK", $this->moduleBaseLink);
     $smarty->assign("T_RSS_PROVIDED_FEEDS_MODES", $this->feedProviderModes);
     $smarty->assign("T_RSS_PROVIDED_FEEDS_TYPES", $this->providedFeeds);
     $smarty->assign("T_RSS_PROVIDED_FEEDS_LESSON_TYPES", $this->lessonProvidedFeeds);
     if (isset($_GET['delete_feed']) && eF_checkParameter($_GET['delete_feed'], 'id')) {
         try {
             if ($_GET['type'] == 'provider') {
                 eF_deleteTableData("module_rss_provider", "id=" . $_GET['delete_feed']);
             } else {
                 eF_deleteTableData("module_rss_feeds", "id=" . $_GET['delete_feed']);
             }
         } catch (Exception $e) {
             handleAjaxExceptions($e);
         }
         exit;
     } elseif (isset($_GET['deactivate_feed']) && eF_checkParameter($_GET['deactivate_feed'], 'id')) {
         try {
             if ($_GET['type'] == 'provider') {
                 eF_updateTableData("module_rss_provider", array("active" => 0), "id=" . $_GET['deactivate_feed']);
             } else {
                 eF_updateTableData("module_rss_feeds", array("active" => 0), "id=" . $_GET['deactivate_feed']);
             }
             echo 0;
         } catch (Exception $e) {
             handleAjaxExceptions($e);
         }
         exit;
     } elseif (isset($_GET['activate_feed']) && eF_checkParameter($_GET['activate_feed'], 'file')) {
         //Although db operations do not support exceptions (yet), we leave this here for future support
         try {
             if ($_GET['type'] == 'provider') {
                 eF_updateTableData("module_rss_provider", array("active" => 1), "id=" . $_GET['activate_feed']);
             } else {
                 eF_updateTableData("module_rss_feeds", array("active" => 1), "id=" . $_GET['activate_feed']);
             }
             echo 1;
         } catch (Exception $e) {
             handleAjaxExceptions($e);
         }
         exit;
     } else {
         if (isset($_GET['add_feed']) || isset($_GET['edit_feed']) && eF_checkParameter($_GET['edit_feed'], 'id')) {
             if ($_SESSION['s_lesson_user_type']) {
                 $type = $_SESSION['s_lesson_user_type'];
             } else {
                 $type = $this->getCurrentUser()->getType();
             }
             $smarty->assign("T_RSS_USERTYPE", $type);
             $feeds = $this->getFeeds();
             $lessons = array(-1 => _RSS_NONE, 0 => _ALLLESSONS);
             $result = EfrontLesson::getLessons();
             foreach ($result as $key => $lesson) {
                 $lessons[$key] = $lesson['name'];
             }
             isset($_GET['add_feed']) ? $postTarget = "&add_feed=1" : ($postTarget = "&edit_feed=" . $_GET['edit_feed']);
             $form = new HTML_QuickForm("add_feed_form", "post", $this->moduleBaseUrl . $postTarget, "", null, true);
             $form->registerRule('checkParameter', 'callback', 'eF_checkParameter');
             $form->addElement('text', 'title', _RSS_FEEDTITLE, 'class = "inputText"');
             $form->addElement('text', 'url', _RSS_FEEDURL, 'class = "inputText"');
             $form->addElement('select', 'lessons_ID', _LESSON, $lessons);
             if ($type != 'administrator' && $_SESSION['s_lessons_ID']) {
                 $form->setDefaults(array('lessons_ID' => $_SESSION['s_lessons_ID']));
                 $form->freeze(array('lessons_ID'));
             }
             $form->addElement("advcheckbox", "active", _RSS_ACTIVE, null, 'class = "inputCheckBox"', array(0, 1));
             $form->setDefaults(array('active' => 1));
             $form->addElement("advcheckbox", "only_summary", _RSS_ONLYSUMMARY, null, 'class = "inputCheckBox"', array(0, 1));
             $form->addRule('title', _THEFIELD . ' "' . _RSS_FEEDTITLE . '" ' . _ISMANDATORY, 'required', null, 'client');
             $form->addRule('url', _THEFIELD . ' "' . _RSS_FEEDURL . '" ' . _ISMANDATORY, 'required', null, 'client');
             $form->addRule('title', _INVALIDFIELDDATA, 'checkParameter', 'text');
             $form->addElement('submit', 'submit', _SUBMIT, 'class = "flatButton"');
             if (isset($_GET['edit_feed'])) {
                 $editFeed = $feeds[$_GET['edit_feed']];
                 $form->setDefaults($editFeed);
             }
             if ($form->isSubmitted() && $form->validate()) {
                 //If the form is submitted and validated
                 $values = $form->exportValues();
                 $fields = array("title" => $values['title'], "url" => $values['url'], "active" => $values['active'], "only_summary" => $values['only_summary'], "lessons_ID" => $values['lessons_ID']);
                 if (isset($_GET['add_feed'])) {
                     eF_insertTableData("module_rss_feeds", $fields);
                     $smarty->assign("T_RSS_RSS_MESSAGE", _RSS_SUCCESSFULLYADDEDFEED);
                 } else {
                     eF_updateTableData("module_rss_feeds", $fields, "id=" . $_GET['edit_feed']);
                     $smarty->assign("T_RSS_RSS_MESSAGE", _RSS_SUCCESSFULLYEDITEDFEED);
                     EfrontCache::getInstance()->deleteCache('rss_cache:' . $_GET['edit_feed']);
                 }
             }
             $smarty->assign("T_RSS_ADD_RSS_FORM", $form->toArray());
         } else {
             if (isset($_GET['add_feed_provider']) || isset($_GET['edit_feed_provider']) && eF_checkParameter($_GET['edit_feed_provider'], 'id')) {
                 if ($_SESSION['s_lesson_user_type']) {
                     $type = $_SESSION['s_lesson_user_type'];
                 } else {
                     $type = $this->getCurrentUser()->getType();
                 }
//.........这里部分代码省略.........
开发者ID:bqq1986,项目名称:efront,代码行数:101,代码来源:module_rss.class.php

示例3: doMultiplePlacements

 private function doMultiplePlacements()
 {
     $smarty = $this->getSmartyVar();
     $currentUser = $this->getCurrentUser();
     try {
         if ($_GET['ajax'] == 'multiplePlacementsTable') {
             $users = eF_getTableData("module_hcd_employee_works_at_branch wb, users u", "wb.users_login, sum(assigned) as placements, u.active", "wb.users_login=u.login and wb.assigned = 1 and u.archive=0", "", "users_login");
             foreach ($users as $key => $value) {
                 if ($value['placements'] <= 1) {
                     unset($users[$key]);
                 }
             }
             list($tableSize, $users) = filterSortPage($users);
             $smarty->assign("T_SORTED_TABLE", $_GET['ajax']);
             $smarty->assign("T_TABLE_SIZE", $tableSize);
             $smarty->assign("T_DATA_SOURCE", $users);
         }
     } catch (Exception $e) {
         handleAjaxExceptions($e);
     }
 }
开发者ID:kaseya-university,项目名称:efront,代码行数:21,代码来源:module_administrator_tools.class.php

示例4: askInformation


//.........这里部分代码省略.........
                            $tooltipInfo[] = '<div class = "infoEntry"><span>' . _OTHERINFO . "</span><span>: {$value}</span></div>";
                            break;
                        case 'price_string':
                            !$lesson->lesson['course_only'] ? $tooltipInfo[] = '<div class = "infoEntry"><span>' . _PRICE . "</span><span>: {$value}</span></div>" : null;
                            break;
                        default:
                            break;
                    }
                }
            }
            if ($string = implode("", $tooltipInfo)) {
                echo $string;
            } else {
                echo _NODATAFOUND;
            }
        }
        if (isset($_GET['courses_ID']) && eF_checkParameter($_GET['courses_ID'], 'id')) {
            $course = new EfrontCourse($_GET['courses_ID']);
            $courseInformation = $course->getInformation();
            $languages = EfrontSystem::getLanguages(true);
            if ($courseInformation['professors']) {
                foreach ($courseInformation['professors'] as $value) {
                    $professorsString[] = $value['name'] . ' ' . $value['surname'];
                }
                $courseInformation['professors'] = implode(", ", $professorsString);
            }
            $course->course['price'] ? $priceString = formatPrice($course->course['price'], array($course->options['recurring'], $course->options['recurring_duration']), true) : ($priceString = false);
            $courseInformation['price_string'] = $priceString;
            foreach ($courseInformation as $key => $value) {
                if ($value) {
                    switch ($key) {
                        case 'language':
                            $tooltipInfo[] = '<div class = "infoEntry"><span>' . _LANGUAGE . "</span><span>: {$languages[$value]}</span></div>";
                            break;
                        case 'professors':
                            $tooltipInfo[] = '<div class = "infoEntry"><span>' . _PROFESSORS . "</span><span>: {$value}</span></div>";
                            break;
                        case 'lessons_number':
                            $tooltipInfo[] = '<div class = "infoEntry"><span>' . _LESSONS . "</span><span>: {$value}</span></div>";
                            break;
                        case 'instances':
                            $tooltipInfo[] = '<div class = "infoEntry"><span>' . _COURSEINSTANCES . "</span><span>: {$value}</span></div>";
                            break;
                        case 'general_description':
                            $tooltipInfo[] = '<div class = "infoEntry"><span>' . _DESCRIPTION . "</span><span>: {$value}</span></div>";
                            break;
                        case 'assessment':
                            $tooltipInfo[] = '<div class = "infoEntry"><span>' . _ASSESSMENT . "</span><span>: {$value}</span></div>";
                            break;
                        case 'objectives':
                            $tooltipInfo[] = '<div class = "infoEntry"><span>' . _OBJECTIVES . "</span><span>: {$value}</span></div>";
                            break;
                        case 'lesson_topics':
                            $tooltipInfo[] = '<div class = "infoEntry"><span>' . _COURSETOPICS . "</span><span>: {$value}</span></div>";
                            break;
                        case 'resources':
                            $tooltipInfo[] = '<div class = "infoEntry"><span>' . _RESOURCES . "</span><span>: {$value}</span></div>";
                            break;
                        case 'other_info':
                            $tooltipInfo[] = '<div class = "infoEntry"><span>' . _OTHERINFO . "</span><span>: {$value}</span></div>";
                            break;
                        case 'price_string':
                            $tooltipInfo[] = '<div class = "infoEntry"><span>' . _PRICE . "</span><span>: {$value}</span></div>";
                            break;
                        default:
                            break;
                    }
                }
            }
            if ($string = implode("", $tooltipInfo)) {
                echo $string;
            } else {
                echo _NODATAFOUND;
            }
        }
        // For eFront social
        if (isset($_GET['common_lessons']) && isset($_GET['user1']) && isset($_GET['user2'])) {
            $user1 = EfrontUserFactory::factory($_GET['user1']);
            if ($user1->getType() != "administrator") {
                $common_lessons = $user1->getCommonLessons($_GET['user2']);
                // pr($common_lessons);
                foreach ($common_lessons as $id => $lesson) {
                    if (strlen($lesson['name']) > 25) {
                        $lesson['name'] = substr($lesson['name'], 0, 22) . "...";
                    }
                    $tooltipInfo[] = '<div class = "infoEntry"><span>' . $lesson['name'] . "</span><span></span></div>";
                }
                if ($string = implode("", $tooltipInfo)) {
                    echo $string;
                } else {
                    echo _NODATAFOUND;
                }
            } else {
                echo _NODATAFOUND;
            }
        }
    } catch (Exception $e) {
        handleAjaxExceptions($e);
    }
}
开发者ID:bqq1986,项目名称:efront,代码行数:101,代码来源:ask.php

示例5: getDashboardModule

 /**
  * (non-PHPdoc)
  * @see libraries/EfrontModule#getDashboardModule()
  */
 public function getDashboardModule()
 {
     $smarty = $this->getSmartyVar();
     $smarty->assign("T_MODULE_BASEURL", $_SERVER['PHP_SELF'] . '?ctg=personal');
     try {
         if (isset($_GET['ajax']) && $_GET['ajax'] == 'vLabTable') {
             $this->getAjaxResults();
             $smarty->display($this->moduleBaseDir . "module_vLab_dashboard.tpl");
             exit;
         }
     } catch (Exception $e) {
         handleAjaxExceptions($e);
     }
     return true;
 }
开发者ID:kaseya-university,项目名称:efront,代码行数:19,代码来源:module_vLab.class.php

示例6: handleAjaxActions


//.........这里部分代码省略.........
                         $test->redoOnlyWrong($result[0]['users_LOGIN']);
                         exit;
                     } else {
                         if (isset($_GET['delete_done_test'])) {
                             if (isset($_GET['all'])) {
                                 $this->undo($this->completedTest['login']);
                                 //eF_deleteTableData("completed_tests", "users_LOGIN='".$this -> completedTest['login']."' and tests_ID=".$this -> completedTest['testsId']);
                             } else {
                                 $this->undo($this->completedTest['login'], $this->completedTest['id']);
                                 //eF_deleteTableData("completed_tests", "id=".$this -> completedTest['id']);
                             }
                             exit;
                         } else {
                             if (isset($_GET['question_score'])) {
                                 if (mb_strpos($_GET['question_score'], ",") !== false) {
                                     $_GET['question_score'] = str_replace(",", ".", $_GET['question_score']);
                                 }
                                 if (in_array($_GET['question'], array_keys($this->questions))) {
                                     if (is_numeric($_GET['question_score']) && $_GET['question_score'] <= 100 && $_GET['question_score'] >= 0) {
                                         $this->questions[$_GET['question']]->score = $_GET['question_score'];
                                         $this->questions[$_GET['question']]->scoreInTest = round($_GET['question_score'] * $this->getQuestionWeight($_GET['question']), 3);
                                         $this->questions[$_GET['question']]->pending = 0;
                                         $score = 0;
                                         foreach ($this->questions as $question) {
                                             $this->completedTest['scoreInTest'][$question->question['id']] = $question->scoreInTest;
                                             $score += $question->scoreInTest;
                                         }
                                         $this->completedTest['score'] = round($score, 2);
                                         $testUser = EfrontUserFactory::factory($this->completedTest['login']);
                                         if ($this->test['mastery_score'] && $this->test['mastery_score'] > $this->completedTest['score']) {
                                             if ($this->getPotentialScore() < $this->test['mastery_score']) {
                                                 $this->completedTest['status'] = 'failed';
                                                 $flag = 0;
                                                 //$testUser -> setSeenUnit($this -> test['content_ID'], $this -> test['lessons_ID'], 0);
                                             }
                                         } else {
                                             if ($this->test['mastery_score'] && $this->test['mastery_score'] <= $this->completedTest['score']) {
                                                 $this->completedTest['status'] = 'passed';
                                                 $flag = 1;
                                                 //$testUser -> setSeenUnit($this -> test['content_ID'], $this -> test['lessons_ID'], 1);
                                             }
                                         }
                                         $this->completedTest['pending'] = 0;
                                         foreach ($this->getQuestions(true) as $question) {
                                             if ($question->pending) {
                                                 $this->completedTest['pending'] = 1;
                                             }
                                         }
                                         try {
                                             $lesson = new EfrontLesson($this->test['lessons_ID']);
                                             $lesson_name = $lesson->lesson['name'];
                                         } catch (EfrontLessonException $e) {
                                             $lesson_name = _SKILLGAPTESTS;
                                         }
                                         if (!$this->completedTest['pending']) {
                                             EfrontEvent::triggerEvent(array("type" => EfrontEvent::TEST_MARKED, "users_LOGIN" => $this->completedTest['login'], "lessons_ID" => $this->test['lessons_ID'], "lessons_name" => $lesson_name, "entity_ID" => $this->test['id'], "entity_name" => $this->test['name']));
                                         }
                                         if ($this->completedTest['status'] == 'failed' && $this->completedTest['pending'] != 1) {
                                             EfrontEvent::triggerEvent(array("type" => EfrontEvent::TEST_FAILURE, "users_LOGIN" => $this->completedTest['login'], "lessons_ID" => $this->test['lessons_ID'], "lessons_name" => $lesson_name, "entity_ID" => $this->test['id'], "entity_name" => $this->test['name']));
                                         }
                                         $this->save();
                                         $testUser->setSeenUnit($this->test['content_ID'], $this->test['lessons_ID'], $flag);
                                         echo json_encode($this->completedTest);
                                     } else {
                                         throw new EfrontTestException(_INVALIDSCORE . ': ' . $_GET['test_score'], EfrontTestException::INVALID_SCORE);
                                     }
                                 } else {
                                     throw new EfrontTestException(_INVALIDID . ': ' . $_GET['question'], EfrontTestException::QUESTION_NOT_EXISTS);
                                 }
                                 exit;
                             } else {
                                 if (isset($_GET['question_feedback'])) {
                                     if (in_array($_GET['question'], array_keys($this->questions))) {
                                         $this->questions[$_GET['question']]->feedback = $_GET['question_feedback'];
                                         $this->save();
                                         echo $_GET['question_feedback'];
                                     } else {
                                         throw new EfrontTestException(_INVALIDID . ': ' . $_GET['question'], EfrontTestException::QUESTION_NOT_EXISTS);
                                     }
                                     exit;
                                 } else {
                                     if (isset($_GET['delete_file'])) {
                                         $file = new EfrontFile($_GET['delete_file']);
                                         $testDirectory = $this->getDirectory();
                                         if (strpos($file['path'], $testDirectory['path']) !== false) {
                                             $file->delete();
                                         }
                                         exit;
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     } catch (Exception $e) {
         handleAjaxExceptions($e);
     }
 }
开发者ID:kaseya-university,项目名称:efront,代码行数:101,代码来源:test.class.php

示例7: handleAjaxActions

 /**
  * Handle AJAX actions
  *
  * This function is used to perform the necessary ajax actions,
  * that may be fired by the file manager
  * <br/>Example:
  * <code>
  * $basedir    = $currentLesson -> getDirectory();
  * $filesystem = new FileSystemTree($basedir);
  * $filesystem -> handleAjaxActions();
  * </code>
  *
  * @param EfrontUser $currentUser The current user
  * @since 3.5.0
  * @access public
  */
 public function handleAjaxActions($currentUser)
 {
     if (isset($_GET['delete_file']) && (eF_checkParameter($_GET['delete_file'], 'id') || strpos(urldecode($_GET['delete_file']), $this->dir['path']) !== false)) {
         try {
             $file = new EfrontFile(urldecode($_GET['delete_file']));
             if (strpos($file['path'], $this->dir['path']) === false) {
                 throw new EfrontFileException(_YOUCANNOTACCESSTHEREQUESTEDRESOURCE, EfrontFileException::UNAUTHORIZED_ACTION);
             }
             $file->delete();
         } catch (Exception $e) {
             handleAjaxExceptions($e);
         }
         exit;
     } else {
         if (isset($_GET['share']) && (eF_checkParameter($_GET['share'], 'id') || strpos(urldecode($_GET['share']), $this->dir['path']) !== false)) {
             try {
                 $file = new EfrontFile(urldecode($_GET['share']));
                 if (strpos($file['path'], $this->dir['path']) === false) {
                     throw new EfrontFileException(_YOUCANNOTACCESSTHEREQUESTEDRESOURCE, EfrontFileException::UNAUTHORIZED_ACTION);
                 }
                 $file->share();
             } catch (Exception $e) {
                 handleAjaxExceptions($e);
             }
             exit;
         } else {
             if (isset($_GET['unshare']) && (eF_checkParameter($_GET['unshare'], 'id') || strpos(urldecode($_GET['unshare']), $this->dir['path']) !== false)) {
                 try {
                     $file = new EfrontFile(urldecode($_GET['unshare']));
                     if (strpos($file['path'], $this->dir['path']) === false) {
                         throw new EfrontFileException(_YOUCANNOTACCESSTHEREQUESTEDRESOURCE, EfrontFileException::UNAUTHORIZED_ACTION);
                     }
                     $file->unshare();
                 } catch (Exception $e) {
                     handleAjaxExceptions($e);
                 }
                 exit;
             } else {
                 if (isset($_GET['uncompress']) && (eF_checkParameter($_GET['uncompress'], 'id') || strpos(urldecode($_GET['uncompress']), $this->dir['path']) !== false)) {
                     try {
                         $file = new EfrontFile(urldecode($_GET['uncompress']));
                         if (strpos($file['path'], $this->dir['path']) === false) {
                             throw new EfrontFileException(_YOUCANNOTACCESSTHEREQUESTEDRESOURCE, EfrontFileException::UNAUTHORIZED_ACTION);
                         }
                         $file->uncompress();
                     } catch (Exception $e) {
                         handleAjaxExceptions($e);
                     }
                     exit;
                 } elseif (isset($_GET['delete_folder']) && (eF_checkParameter($_GET['delete_folder'], 'id') || strpos(urldecode($_GET['delete_folder']), $this->dir['path']) !== false)) {
                     try {
                         $directory = new EfrontDirectory(urldecode($_GET['delete_folder']));
                         if (strpos($directory['path'], $this->dir['path']) === false) {
                             throw new EfrontFileException(_YOUCANNOTACCESSTHEREQUESTEDRESOURCE, EfrontFileException::UNAUTHORIZED_ACTION);
                         }
                         $directory->delete();
                     } catch (Exception $e) {
                         handleAjaxExceptions($e);
                     }
                     exit;
                 } elseif (isset($_GET['download']) && (eF_checkParameter($_GET['download'], 'id') || strpos(urldecode($_GET['download']), $this->dir['path']) !== false)) {
                     try {
                         $file = new EfrontFile(urldecode($_GET['download']));
                         if (strpos($file['path'], $this->dir['path']) === false) {
                             throw new EfrontFileException(_YOUCANNOTACCESSTHEREQUESTEDRESOURCE, EfrontFileException::UNAUTHORIZED_ACTION);
                         }
                         $file->sendFile(true);
                     } catch (Exception $e) {
                         handleAjaxExceptions($e);
                     }
                     exit;
                 } elseif (isset($_GET['view']) && (eF_checkParameter($_GET['view'], 'id') || strpos(urldecode($_GET['view']), $this->dir['path']) !== false)) {
                     try {
                         $file = new EfrontFile(urldecode($_GET['view']));
                         if (strpos($file['path'], $this->dir['path']) === false) {
                             throw new EfrontFileException(_YOUCANNOTACCESSTHEREQUESTEDRESOURCE, EfrontFileException::UNAUTHORIZED_ACTION);
                         }
                         $file->sendFile(false);
                     } catch (Exception $e) {
                         handleAjaxExceptions($e);
                     }
                     exit;
                 } elseif (isset($_GET['update']) && (eF_checkParameter($_GET['update'], 'id') || strpos(urldecode($_GET['update']), $this->dir['path']) !== false)) {
                     try {
//.........这里部分代码省略.........
开发者ID:kaseya-university,项目名称:efront,代码行数:101,代码来源:filesystem.class.php

示例8: getModule


//.........这里部分代码省略.........
     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']) {
                             $user->deactivate();
                         } else {
                             $user->activate();
                         }
                         echo json_encode(array('status' => 1, 'active' => $user->user['active']));
                     }
                     exit;
                 } else {
                     if (isset($_GET['ajax']) && isset($_GET['deactivate_all_users'])) {
                         //eF_updateTableData("users", array("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("active" => 0), "login='" . $value['login'] . "'");
                         }
                         exit;
                     }
                 }
             }
         }
     } catch (Exception $e) {
         handleAjaxExceptions($e);
     }
     return true;
 }
开发者ID:bqq1986,项目名称:efront,代码行数:101,代码来源:module_idle_users.class.php

示例9: getSmartyTpl

 public function getSmartyTpl()
 {
     $currentUser = $this->getCurrentUser();
     $rules = $this->getRules();
     $smarty = $this->getSmartyVar();
     if ($currentUser->getRole($this->getCurrentLesson()) == 'professor' || $currentUser->getRole($this->getCurrentLesson()) == 'student') {
         $currentLesson = $this->getCurrentLesson();
         $currentLessonID = $currentLesson->lesson['id'];
         if (!isset($_SESSION['module_journal_dimension']) || count($_GET) == 2 && $_GET['ctg'] == 'module' && $_GET['op'] == 'module_journal' || count($_GET) == 3 && $_GET['ctg'] == 'module' && $_GET['op'] == 'module_journal' && $_GET['new_lesson_id'] == $currentLessonID) {
             $_SESSION['module_journal_dimension'] = 'small';
         }
         if (!isset($_SESSION['module_journal_entries_from']) || count($_GET) == 2 && $_GET['ctg'] == 'module' && $_GET['op'] == 'module_journal' || count($_GET) == 3 && $_GET['ctg'] == 'module' && $_GET['op'] == 'module_journal' && $_GET['new_lesson_id'] == $currentLessonID) {
             $_SESSION['module_journal_entries_from'] = '-1';
         }
         if (isset($_SESSION['module_journal_scroll_position'])) {
             $smarty->assign("T_JOURNAL_SCROLL_POSITION", $_SESSION['module_journal_scroll_position']);
         }
         $smarty->assign("T_JOURNAL_DIMENSIONS", $_SESSION['module_journal_dimension']);
         $smarty->assign("T_JOURNAL_ENTRIES_FROM", $_SESSION['module_journal_entries_from']);
         $entries = $this->getEntries($currentUser->user['login'], $_SESSION['module_journal_entries_from']);
         global $popup;
         isset($popup) && $popup == 1 ? $popup_ = '&popup=1' : ($popup_ = '');
     }
     $smarty->assign("T_JOURNAL_BASEURL", $this->moduleBaseUrl);
     $smarty->assign("T_JOURNAL_BASELINK", $this->moduleBaseLink);
     if (isset($_GET['edit_allow_export']) && $_GET['edit_allow_export'] == '1' && isset($_GET['allow'])) {
         try {
             $object = eF_getTableData("module_journal_settings", "id", "name='export'");
             eF_updateTableData("module_journal_settings", array("value" => $_GET['allow']), "id=" . $object[0]['id']);
         } catch (Exception $e) {
             handleAjaxExceptions($e);
         }
         exit;
     }
     if (isset($_GET['edit_professor_preview']) && $_GET['edit_professor_preview'] == '1' && isset($_GET['preview'])) {
         try {
             $object = eF_getTableData("module_journal_settings", "id", "name='preview'");
             eF_updateTableData("module_journal_settings", array("value" => $_GET['preview']), "id=" . $object[0]['id']);
         } catch (Exception $e) {
             handleAjaxExceptions($e);
         }
         exit;
     }
     if (isset($_GET['dimension']) && eF_checkParameter($_GET['dimension'], 'string')) {
         $smarty->assign("T_JOURNAL_DIMENSIONS", $_GET['dimension']);
         $_SESSION['module_journal_dimension'] = $_GET['dimension'];
     }
     if (isset($_GET['entries_from'])) {
         $smarty->assign("T_JOURNAL_ENTRIES_FROM", $_GET['entries_from']);
         $_SESSION['module_journal_entries_from'] = $_GET['entries_from'];
     }
     if (isset($_GET['delete_rule']) && eF_checkParameter($_GET['delete_rule'], 'id') && in_array($_GET['delete_rule'], array_keys($rules))) {
         try {
             eF_deleteTableData("module_journal_rules", "id=" . $_GET['delete_rule']);
         } catch (Exception $e) {
             handleAjaxExceptions($e);
         }
         exit;
     }
     if (isset($_GET['deactivate_rule']) && eF_checkParameter($_GET['deactivate_rule'], 'id') && in_array($_GET['deactivate_rule'], array_keys($rules))) {
         eF_updateTableData("module_journal_rules", array('active' => 0), "id=" . $_GET['deactivate_rule']);
     }
     if (isset($_GET['activate_rule']) && eF_checkParameter($_GET['activate_rule'], 'id') && in_array($_GET['activate_rule'], array_keys($rules))) {
         eF_updateTableData("module_journal_rules", array('active' => 1), "id=" . $_GET['activate_rule']);
     }
     if (isset($_GET['delete_entry']) && eF_checkParameter($_GET['delete_entry'], 'id') && in_array($_GET['delete_entry'], array_keys($entries))) {
         $object = eF_getTableData("module_journal_entries", "users_LOGIN", "id=" . $_GET['delete_entry']);
         if ($object[0]['users_LOGIN'] != $_SESSION['s_login']) {
             eF_redirect($this->moduleBaseUrl . "&message=" . urlencode(_JOURNAL_NOACCESS) . $popup_);
             exit;
         }
         eF_deleteTableData("module_journal_entries", "id=" . $_GET['delete_entry']);
     }
     if (isset($_GET['saveas']) && $_GET['saveas'] == '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->SetHeaderMargin(PDF_MARGIN_HEADER);
         $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
         $pdf->setHeaderFont(array('Freeserif', 'I', 11));
         $pdf->setFooterFont(array('Freeserif', '', 8));
         $pdf->setHeaderData('', '', '', _JOURNAL_NAME);
         $pdf->AliasNbPages();
         $pdf->AddPage();
         $pdf->SetFont('Freeserif', '', 10);
         $pdf->SetTextColor(0, 0, 0);
         foreach ($entries as $entry) {
             $pdf->Cell(0, 0, $entry['entry_date_formatted'], 0, 1, L, 0);
             $pdf->writeHTML('<br/>', true, false, true, false, '');
             $pdf->writeHTML($entry['entry_body'], true, false, true, false, '');
             $pdf->writeHTML('<div style="height: 5px;"></div>', true, false, true, false, '');
             $pdf->writeHTML('<hr>', true, false, true, false, '');
         }
         $fileNamePdf = "journal.pdf";
         header("Content-type: application/pdf");
         header("Content-disposition: attachment; filename=" . $fileNamePdf);
         echo $pdf->Output('', 'S');
//.........这里部分代码省略.........
开发者ID:bqq1986,项目名称:efront,代码行数:101,代码来源:module_journal.class.php

示例10: getSmartyTpl


//.........这里部分代码省略.........
                         if ($_GET['export_student_excel'] == 'current') {
                             $workSheet =& $workBook->addWorksheet($currentLesson->lesson['name']);
                             $this->studentLessonToExcel($currentLessonID, $currentLesson->lesson['name'], $currentUser, $workBook, $workSheet);
                         } else {
                             if ($_GET['export_student_excel'] == 'all') {
                                 $studentLessons = $currentUser->getLessons(false, 'student');
                                 foreach ($studentLessons as $key => $value) {
                                     // Is GradeBook installed for this lesson ?
                                     $installed = eF_getTableData("module_gradebook_users", "*", "lessons_ID=" . $key . " and users_LOGIN='" . $currentUser->user['login'] . "'");
                                     if (sizeof($installed) != 0) {
                                         $subLesson = new EfrontLesson($key);
                                         $workSheet =& $workBook->addWorksheet($subLesson->lesson['name']);
                                         $this->studentLessonToExcel($key, $subLesson->lesson['name'], $currentUser, $workBook, $workSheet);
                                     }
                                 }
                             }
                         }
                         $workBook->close();
                         exit;
                     } else {
                         if (isset($_GET['switch_lesson']) && eF_checkParameter($_GET['switch_lesson'], 'id') && in_array($_GET['switch_lesson'], array_keys($gradeBookLessons))) {
                             $lessonID = $_GET['switch_lesson'];
                             eF_redirect("location:" . $this->moduleBaseUrl . "&lessons_ID=" . $lessonID);
                         }
                     }
                 }
             }
         }
     }
     if (isset($_GET['delete_range']) && eF_checkParameter($_GET['delete_range'], 'id') && in_array($_GET['delete_range'], array_keys($ranges))) {
         try {
             eF_deleteTableData("module_gradebook_ranges", "id=" . $_GET['delete_range']);
         } catch (Exception $e) {
             handleAjaxExceptions($e);
         }
         exit;
     } else {
         if (isset($_GET['add_range']) || isset($_GET['edit_range']) && eF_checkParameter($_GET['edit_range'], 'id') && in_array($_GET['edit_range'], array_keys($ranges))) {
             $grades = array();
             for ($i = 0; $i <= 100; $i++) {
                 $grades[$i] = $i;
             }
             isset($_GET['add_range']) ? $postTarget = "&add_range=1" : ($postTarget = "&edit_range=" . $_GET['edit_range']);
             $form = new HTML_QuickForm("add_range_form", "post", $this->moduleBaseUrl . $postTarget, "", null, true);
             $form->registerRule('checkParameter', 'callback', 'eF_checkParameter');
             // XXX
             $form->addElement('select', 'range_from', _GRADEBOOK_RANGE_FROM, $grades);
             $form->addElement('select', 'range_to', _GRADEBOOK_RANGE_TO, $grades);
             $form->addElement('text', 'grade', _GRADEBOOK_GRADE, 'class = "inputText"');
             $form->addRule('grade', _THEFIELD . ' "' . _GRADEBOOK_GRADE . '" ' . _ISMANDATORY, 'required', null, 'client');
             $form->addRule('grade', _INVALIDFIELDDATA, 'checkParameter', 'text');
             // XXX
             $form->addElement('submit', 'submit', _SUBMIT, 'class = "flatButton"');
             if (isset($_GET['edit_range'])) {
                 $editRange = $ranges[$_GET['edit_range']];
                 $form->setDefaults($editRange);
             }
             if ($form->isSubmitted() && $form->validate()) {
                 $error = $invalid_range = false;
                 $values = $form->exportValues();
                 $fields = array("range_from" => $values['range_from'], "range_to" => $values['range_to'], "grade" => $values['grade']);
                 if (isset($_GET['edit_range'])) {
                     // do not check it below ...
                     unset($ranges[$_GET['edit_range']]);
                 }
                 foreach ($ranges as $range) {
开发者ID:kaseya-university,项目名称:efront,代码行数:67,代码来源:module_gradebook.class.php

示例11: getModule

 /**
  * The main functionality
  *
  * (non-PHPdoc)
  * @see libraries/EfrontModule#getModule()
  */
 public function getModule()
 {
     $currentLesson = $this->getCurrentLesson();
     $smarty = $this->getSmartyVar();
     $smarty->assign("T_MODULE_BASEDIR", $this->moduleBaseDir);
     $smarty->assign("T_MODULE_BASELINK", $this->moduleBaseLink);
     $smarty->assign("T_MODULE_BASEURL", $this->moduleBaseUrl);
     if ($currentLesson && !$currentLesson->options['digital_library']) {
         $result = eF_getTableDataFlat("module_shared_files", "path", "lessons_ID=" . $currentLesson->lesson['id']);
         $lessonSharedFiles = $result['path'];
         $basedir = new EfrontDirectory($currentLesson->getDirectory());
         if ($_GET['other']) {
             $directory = new EfrontDirectory($_GET['other']);
             if (strpos($directory['path'], $basedir['path']) !== false && strcmp($directory['path'], $basedir['path'])) {
                 $basedir = $directory;
                 $smarty->assign("T_PARENT_DIR", dirname($basedir['path']));
             }
         }
         $smarty->assign("T_CURRENT_DIR", str_replace($currentLesson->getDirectory(), "", $basedir['path']));
         $filesystem = new FileSystemTree($basedir, true);
         $files = $directories = array();
         foreach ($filesystem->tree as $key => $value) {
             $value['image'] = $value->getTypeImage();
             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'], "flash") !== false) {
                 $value['preview'] = true;
             }
             if (in_array($key, $lessonSharedFiles)) {
                 $value['module_shared_files_status'] = true;
             }
             if ($value instanceof EfrontFile) {
                 $files[$key] = (array) $value;
             } elseif ($value instanceof EfrontDirectory) {
                 $value['size'] = 0;
                 $directories[$key] = (array) $value;
             }
         }
         $tableName = "sharedFilesTable";
         $dataSource = array_merge($directories, $files);
         list($tableSize, $dataSource) = filterSortPage($dataSource);
         $smarty->assign("T_TABLE_SIZE", $tableSize);
         if (!empty($dataSource)) {
             $smarty->assign("T_DATA_SOURCE", $dataSource);
         }
         try {
             if (isset($_GET['ajax']) && isset($_GET['share_file'])) {
                 try {
                     $entity = new EfrontFile(urldecode($_GET['share_file']));
                 } catch (Exception $e) {
                     $entity = new EfrontDirectory(urldecode($_GET['share_file']));
                 }
                 if (in_array($entity['path'], $lessonSharedFiles)) {
                     eF_deleteTableData("module_shared_files", "path='" . $entity['path'] . "' and lessons_ID=" . $currentLesson->lesson['id']);
                     $added = false;
                     if ($entity instanceof EfrontDirectory) {
                         $subTree = new FileSystemTree($entity, true);
                         $insertValues = array();
                         foreach ($subTree->tree as $value) {
                             eF_deleteTableData("module_shared_files", "path='" . $value['path'] . "' and lessons_ID=" . $currentLesson->lesson['id']);
                         }
                     }
                 } else {
                     eF_insertTableData("module_shared_files", array("path" => $entity['path'], 'lessons_ID' => $currentLesson->lesson['id']));
                     $added = true;
                     if ($entity instanceof EfrontDirectory) {
                         $subTree = new FileSystemTree($entity, true);
                         $insertValues = array();
                         foreach ($subTree->tree as $value) {
                             $insertValues[] = array("path" => $value['path'], 'lessons_ID' => $currentLesson->lesson['id']);
                         }
                         if (!empty($insertValues)) {
                             eF_insertTableDataMultiple("module_shared_files", $insertValues);
                         }
                     }
                 }
                 echo json_encode(array('status' => 1, 'added' => $added));
                 exit;
             }
         } catch (Exception $e) {
             handleAjaxExceptions($e);
         }
         return true;
     } else {
         if ($currentLesson) {
             $currentLesson->options['digital_library'] = 0;
             $currentLesson->persist();
             eF_redirect($this->moduleBaseUrl . '&message=' . urlencode(_MODULE_SHARED_FILES_SHAREDFILESENABLED));
             //$this->setMessageVar(_MODULE_SHARED_FILES_SHAREDFILESENABLED);
             //$smarty -> assign("T_SHARED_FILES_ENABLED", true);
         }
     }
 }
开发者ID:kaseya-university,项目名称:efront,代码行数:97,代码来源:module_shared_files.class.php

示例12: handleInstallationExceptions

 public static function handleInstallationExceptions($e)
 {
     if ($_GET['unattended']) {
         handleAjaxExceptions($e);
     } else {
         handleNormalFlowExceptions($e);
     }
 }
开发者ID:jiangjunt,项目名称:efront_open_source,代码行数:8,代码来源:install.php


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