本文整理汇总了PHP中EfrontLesson::getLessons方法的典型用法代码示例。如果您正苦于以下问题:PHP EfrontLesson::getLessons方法的具体用法?PHP EfrontLesson::getLessons怎么用?PHP EfrontLesson::getLessons使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EfrontLesson
的用法示例。
在下文中一共展示了EfrontLesson::getLessons方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
}
$form->addElement('text', 'price', _PRICE, 'class = "inputText" style = "width:50px"');
//Add the price, active and submit button to the form
$form->addElement('advcheckbox', 'active', _ACTIVENEUTRAL, null, null, array(0, 1));
$form->addElement('advcheckbox', 'show_catalog', _SHOWLESSONINCATALOG, null, null, array(0, 1));
$courseOnly = $form->addElement('radio', 'course_only', _LESSONAVAILABLE, _COURSEONLY, 1, 'onclick = "$$(\'tr.only_lesson\').each(function(s) {s.hide()})"');
$directAccess = $form->addElement('radio', 'course_only', _LESSONAVAILABLE, _DIRECTLY, 0, 'onclick = "$$(\'tr.only_lesson\').each(function(s) {s.show()});if ($(\'recurring\').options[$(\'recurring\').selectedIndex].value == 0) {$(\'duration_row\').hide();}"');
$recurringOptions = array(0 => _NO, 'D' => _DAILY, 'W' => _WEEKLY, 'M' => _MONTHLY, 'Y' => _YEARLY);
$recurringDurations = array('D' => array_combine(range(1, 90), range(1, 90)), 'W' => array_combine(range(1, 52), range(1, 52)), 'M' => array_combine(range(1, 24), range(1, 24)), 'Y' => array_combine(range(1, 5), range(1, 5)));
//Imposed by paypal interface
$form->addElement('select', 'recurring', _SUBSCRIPTION, $recurringOptions, 'id = "recurring" onchange = "$(\'duration_row\').show();$$(\'span\').each(function (s) {if (s.id.match(\'_duration\')) {s.hide();}});if (this.selectedIndex) {$(this.options[this.selectedIndex].value+\'_duration\').show();} else {$(\'duration_row\').hide();}"');
$form->addElement('select', 'D_duration', _DAYSCONDITIONAL, $recurringDurations['D']);
$form->addElement('select', 'W_duration', _WEEKSCONDITIONAL, $recurringDurations['W']);
$form->addElement('select', 'M_duration', _MONTHSCONDITIONAL, $recurringDurations['M']);
$form->addElement('select', 'Y_duration', _YEARSCONDITIONAL, $recurringDurations['Y']);
$lessons = EfrontLesson::getLessons();
$lessonsList = array(0 => _SELECTLESSON, -1 => '---------------');
foreach ($lessons as $value) {
$lessonsList[$value['id']] = $value['name'];
}
unset($lessonsList[$_GET['edit_lesson']]);
$form->addElement('text', 'max_users', _MAXIMUMUSERS, 'class = "inputText" style = "width:50px"');
$form->addElement('hidden', 'copy_properties', null, 'id="copy_properties"');
//Convert to autocomplete input fields to show categories
//$form -> addElement('select', 'share_folder', _SHAREFOLDERWITH, $lessonsList, 'id = "share_folder" onchange = "$(\'clone_lesson\').options.selectedIndex=0;this.options.selectedIndex ? $(\'clone_lesson\').disabled = \'disabled\' : $(\'clone_lesson\').disabled = \'\'"');
//$form -> addElement('select', 'clone_lesson', _CLONELESSON, $lessonsList, 'id = "clone_lesson" onchange = "$(\'share_folder\').options.selectedIndex=0;this.options.selectedIndex ? $(\'share_folder\').disabled = \'disabled\' : $(\'share_folder\').disabled = \'\'"');
$form->addElement('hidden', 'share_folder', null, 'id = "share_folder" onchange = "$(\'clone_lesson\').options.selectedIndex=0;this.options.selectedIndex ? $(\'clone_lesson\').disabled = \'disabled\' : $(\'clone_lesson\').disabled = \'\'"');
$form->addElement('hidden', 'clone_lesson', null, 'id = "clone_lesson" onchange = "$(\'share_folder\').options.selectedIndex=0;this.options.selectedIndex ? $(\'share_folder\').disabled = \'disabled\' : $(\'share_folder\').disabled = \'\'"');
$form->addElement('text', 'duration', _AVAILABLEFOR, 'style = "width:50px;"');
$form->addRule('duration', _THEFIELD . ' "' . _AVAILABLEFOR . '" ' . _MUSTBENUMERIC, 'numeric', null, 'client');
$form->addElement('text', 'access_limit', _AVAILABLEFOR, 'style = "width:50px;"');
示例2: foreach
<?php
if (str_replace(DIRECTORY_SEPARATOR, "/", __FILE__) == $_SERVER['SCRIPT_FILENAME']) {
exit;
}
try {
if (!isset($lessons) || !$lessons && !is_array($lessons)) {
$lessons = EfrontLesson::getLessons(true);
foreach ($lessons as $key => $lesson) {
if ($lesson->lesson['archive'] || !$lesson->lesson['active']) {
unset($lessons[$key]);
}
}
}
if (!isset($courses) || !$courses && !is_array($courses)) {
//$courses = EfrontCourse :: getCourses(true);
$constraints = array('active' => true, 'archive' => false, 'instance' => false, 'sort' => 'name');
$constraints['required_fields'] = array('has_instances');
$courses = EfrontCourse::getAllCourses($constraints);
if ($_SESSION['s_current_branch']) {
//filter out courses that don't belong to the current branch url
$stats_filters = array();
$branches = array($_SESSION['s_current_branch']);
$branchesTree = new EfrontBranchesTree();
$iterator = new EfrontNodeFilterIterator(new RecursiveIteratorIterator(new RecursiveArrayIterator($branchesTree->getNodeChildren($_SESSION['s_current_branch'])), RecursiveIteratorIterator::SELF_FIRST));
foreach ($iterator as $key => $value) {
$branches[] = $key;
}
$result = eF_getTableDataFlat("module_hcd_course_to_branch", "courses_ID", "branches_ID in (" . implode(",", $branches) . ")");
foreach ($courses as $key => $value) {
if (!in_array($key, $result['courses_ID'])) {
示例3: 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();
}
//.........这里部分代码省略.........
示例4: foreach
foreach ($result as $key => $value) {
$value['lessons_ID'] ? $result[$key]['lesson_name'] = $lessonNames[$value['lessons_ID']] : null;
if ($value['action'] == 'content') {
$result[$key]['content_name'] = $contentNames[$value['comments']];
} else {
if ($value['action'] == 'tests' || $value['action'] == 'test_begin') {
$result[$key]['content_name'] = $testNames[$value['comments']];
}
}
}
$smarty->assign("T_USER_LOG", $result);
$traffic = array();
$traffic['lessons'] = array();
$allStats = EfrontStats::getUsersTimeAll();
//$allStats = EfrontStats :: getUsersTimeAll($from, $to);
$result = EfrontLesson::getLessons();
$probed_lessons = array();
foreach ($result as $value) {
$probed_lessons[$value['id']] = array("lessons_ID" => $value['id'], "lessons_name" => $value['name'], "active" => $value['active']);
}
foreach ($probed_lessons as $id => $lesson) {
$userTraffic = $allStats[$id];
//$userTraffic = EfrontStats :: getUsersTime($id, $user_logins, $from, $to);
foreach ($user_logins as $user => $login) {
if ($userTraffic[$login]['accesses']) {
if (!isset($traffic['lessons'][$id])) {
$traffic['lessons'][$id] = $userTraffic[$login];
$traffic['lessons'][$id]['name'] = $lesson['lessons_name'];
$traffic['lessons'][$id]['active'] = $lesson['active'];
} else {
$traffic['lessons'][$id]['accesses'] += $userTraffic[$login]['accesses'];