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


PHP HTML_QuickForm::freeze方法代码示例

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


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

示例1: array

 //These are the entities that will be automatically replaced in custom header/footer
 $systemEntities = array('logo.png', '#siteName', '#siteMoto', '#languages', '#path', '#version');
 $smarty->assign("T_SYSTEM_ENTITIES", $systemEntities);
 //And these are the replacements of the above entities
 $systemEntitiesReplacements = array('{$T_LOGO}', '{$T_CONFIGURATION.site_name}', '{$T_CONFIGURATION.site_motto}', '{$smarty.capture.header_language_code}', '{$title}', '{$smarty.const.G_VERSION_NUM}');
 $load_editor = true;
 $layout_form = new HTML_QuickForm("add_block_form", "post", basename($_SERVER['PHP_SELF']) . "?ctg=themes&theme=" . $layoutTheme->{$layoutTheme->entity}['id'] . (isset($_GET['edit_block']) ? '&edit_block=' . $_GET['edit_block'] : '&add_block=1') . (isset($_GET['theme_layout']) ? '&theme_layout=' . $_GET['theme_layout'] : ''), "", null, true);
 $layout_form->registerRule('checkParameter', 'callback', 'eF_checkParameter');
 $layout_form->addElement('text', 'title', _BLOCKTITLE, 'class = "inputText"');
 $layout_form->addElement('textarea', 'content', _BLOCKCONTENT, 'id="editor_data" class = "mceEditor" style = "width:100%;height:300px;"');
 $layout_form->addElement('submit', 'submit_block', _SAVE, 'class = "flatButton"');
 $layout_form->addRule('title', _THEFIELD . ' "' . _BLOCKTITLE . '" ' . _ISMANDATORY, 'required', null, 'client');
 if (isset($_GET['edit_block'])) {
     $customBlocks[$_GET['edit_block']]['content'] = file_get_contents($basedir . $customBlocks[$_GET['edit_block']]['name'] . '.tpl');
     $layout_form->setDefaults($customBlocks[$_GET['edit_block']]);
     $layout_form->freeze(array('name'));
 }
 if ($layout_form->isSubmitted() && $layout_form->validate()) {
     $values = $layout_form->exportValues();
     if (isset($_GET['edit_block'])) {
         // not rename blocks by editing. It created many unused files
         $values['name'] = $customBlocks[$_GET['edit_block']]['name'];
     } else {
         $values['name'] = time();
         //Use the timestamp as name
     }
     $block = array('name' => $values['name'], 'title' => $values['title']);
     file_put_contents($basedir . $values['name'] . '.tpl', applyEditorOffset($values['content']));
     if (isset($_GET['edit_block'])) {
         $customBlocks[$_GET['edit_block']] = $block;
     } else {
开发者ID:kaseya-university,项目名称:efront,代码行数:31,代码来源:themes.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: EfrontCourse

     $editCourse = new EfrontCourse($_GET['edit_course']);
     $smarty->assign('T_EDIT_COURSE', $editCourse);
     $editCourse->course['price'] = number_format($editCourse->course['price'], 2, '.', '');
     $form->setDefaults($editCourse->options);
     $form->setDefaults($editCourse->course);
     $form->setDefaults(array($editCourse->options['recurring'] . '_duration' => $editCourse->options['recurring_duration']));
     if (G_VERSIONTYPE != 'community') {
         #cpp#ifndef COMMUNITY
         if (G_VERSIONTYPE != 'standard') {
             #cpp#ifndef STANDARD
             if ($editCourse->course['instance_source']) {
                 $instanceSource = new EfrontCourse($editCourse->course['instance_source']);
                 $courseInstances = $instanceSource->getInstances();
                 //Instances inherit course code and direction from their source
                 $form->setDefaults(array("directions_ID" => $instanceSource->course['directions_ID']));
                 $form->freeze(array('directions_ID'));
                 $smarty->assign("T_INSTANCE_SOURCE", $editCourse->course['instance_source']);
             } else {
                 $courseInstances = $editCourse->getInstances();
                 $smarty->assign("T_INSTANCE_SOURCE", $editCourse->course['id']);
             }
             $smarty->assign("T_COURSE_INSTANCES", $courseInstances);
         }
         #cpp#endif
     }
     #cpp#endif
 } else {
     $form->setDefaults(array('active' => 1, 'show_catalog' => 1, 'price' => 0, 'languages_NAME' => $GLOBALS['configuration']['default_language']));
 }
 if (!$_change_) {
     $form->freeze();
开发者ID:kaseya-university,项目名称:efront,代码行数:31,代码来源:courses.php

示例4: getSmartyTpl

 public function getSmartyTpl()
 {
     $smarty = $this->getSmartyVar();
     $currentUser = $this->getCurrentUser();
     $currentLesson = $this->getCurrentLesson();
     $currentLessonID = $currentLesson->lesson['id'];
     if ($currentUser->getRole($this->getCurrentLesson()) == 'professor' || $currentUser->getRole($this->getCurrentLesson()) == 'student') {
         // XXX
         $workbookLessonName = _WORKBOOK_NAME . ' [' . $this->getWorkbookLessonName($currentLessonID) . ']';
         $smarty->assign("T_WORKBOOK_LESSON_NAME", $workbookLessonName);
         $lessonQuestions = $this->getLessonQuestions($currentLessonID);
         $workbookLessons = $this->isWorkbookInstalledByUser($currentUser, $currentUser->getRole($this->getCurrentLesson()), $currentLessonID);
         $workbookItems = $this->getWorkbookItems($currentLessonID);
         $nonOptionalQuestionsNr = $this->getNonOptionalQuestionsNr($workbookItems);
         if ($nonOptionalQuestionsNr != 0) {
             $questionPercentage = (double) (100 / $nonOptionalQuestionsNr);
             $questionPercentage = round($questionPercentage, 2);
         }
         $isWorkbookPublished = $this->isWorkbookPublished($currentLessonID);
     }
     if ($currentUser->getRole($this->getCurrentLesson()) == 'student') {
         $workbookSettings = $this->getWorkbookSettings($currentLessonID);
         $smarty->assign("T_WORKBOOK_SETTINGS", $workbookSettings);
     }
     $smarty->assign("T_WORKBOOK_BASEURL", $this->moduleBaseUrl);
     $smarty->assign("T_WORKBOOK_BASELINK", $this->moduleBaseLink);
     global $popup;
     isset($popup) && $popup == 1 ? $popup_ = '&popup=1' : ($popup_ = '');
     if (isset($_REQUEST['question_preview']) && $_REQUEST['question_preview'] == '1' && isset($_REQUEST['question_id']) && eF_checkParameter($_REQUEST['question_id'], 'id')) {
         $id = $_REQUEST['question_id'];
         if (!in_array($id, array_keys($lessonQuestions))) {
             // reused item
             $reusedQuestion = $this->getReusedQuestionDetails($id);
             $type = $reusedQuestion['type'];
         } else {
             $type = $lessonQuestions[$id]['type'];
         }
         echo $this->questionToHtml($id, $type);
         exit;
     }
     if (isset($_REQUEST['get_progress']) && $_REQUEST['get_progress'] == '1') {
         $isWorkbookCompleted = $this->isWorkbookCompleted($currentUser->user['login'], $currentLessonID, array_keys($workbookItems), $nonOptionalQuestionsNr);
         $studentProgress = $this->getStudentProgress($currentUser->user['login'], $currentLessonID);
         if ($isWorkbookCompleted['is_completed'] == 1) {
             $unitToComplete = $workbookSettings['unit_to_complete'];
             $result = eF_updateTableData('module_workbook_progress', array('completion_date' => time()), "lessons_ID='" . $currentLessonID . "' AND users_LOGIN='" . $currentUser->user['login'] . "'");
             if ($unitToComplete != -1) {
                 $currentUser->setSeenUnit($unitToComplete, $currentLessonID, true);
             }
         }
         echo $studentProgress . '-' . $isWorkbookCompleted['id'];
         exit;
     }
     if (isset($_GET['edit_settings']) && $_GET['edit_settings'] == '1') {
         if ($_SESSION['s_type'] != 'professor') {
             $message = _WORKBOOK_NOACCESS;
             $message_type = 'failure';
             $this->setMessageVar(urlencode($message), $message_type);
         }
         $content = new EfrontContentTree($currentLessonID);
         $iterator = new EfrontNodeFilterIterator(new RecursiveIteratorIterator(new RecursiveArrayIterator($content->tree), RecursiveIteratorIterator::SELF_FIRST), array('ctg_type' => 'theory'));
         $contentOptions = $content->toHTMLSelectOptions($iterator);
         $contentOptions = array(-1 => '-------------') + $contentOptions;
         $workbookSettings = $this->getWorkbookSettings($currentLessonID);
         if ($isWorkbookPublished == 1) {
             $contentOptions[$workbookSettings['unit_to_complete']] = str_replace(' ', '', $contentOptions[$workbookSettings['unit_to_complete']]);
             $contentOptions[$workbookSettings['unit_to_complete']] = str_replace('»', '', $contentOptions[$workbookSettings['unit_to_complete']]);
         }
         $form = new HTML_QuickForm("edit_settings_form", "post", $this->moduleBaseUrl . "&edit_settings=1", "", null, true);
         $form->addElement('text', 'lesson_name', _WORKBOOK_LESSON_NAME, 'class="inputText"');
         $form->addRule('lesson_name', _THEFIELD . ' "' . _WORKBOOK_LESSON_NAME . '" ' . _ISMANDATORY, 'required', null, 'client');
         $form->addElement('advcheckbox', 'allow_print', _WORKBOOK_ALLOW_PRINT, null, 'class="inputCheckBox"', array(0, 1));
         $form->addElement('advcheckbox', 'allow_export', _WORKBOOK_ALLOW_EXPORT, null, 'class="inputCheckBox"', array(0, 1));
         $form->addElement('advcheckbox', 'edit_answers', _WORKBOOK_EDIT_ANSWERS, null, 'class="inputCheckBox"', array(0, 1));
         $form->addElement('select', 'unit_to_complete', _WORKBOOK_UNIT_TO_COMPLETE, $contentOptions);
         $form->addElement('submit', 'submit', _UPDATE, 'class="flatButton"');
         if ($isWorkbookPublished == 1) {
             $form->freeze('unit_to_complete');
         }
         $form->setDefaults($workbookSettings);
         if ($form->isSubmitted() && $form->validate()) {
             $values = $form->exportValues();
             $fields = array("lesson_name" => $values['lesson_name'], "allow_print" => $values['allow_print'], "allow_export" => $values['allow_export'], "edit_answers" => $values['edit_answers'], "unit_to_complete" => $values['unit_to_complete']);
             if (eF_updateTableData("module_workbook_settings", $fields, "id=" . $workbookSettings['id'])) {
                 $smarty->assign("T_WORKBOOK_MESSAGE", _WORKBOOK_SETTINGS_SUCCESSFULLY_EDITED);
                 $smarty->assign("T_WORKBOOK_MESSAGE_TYPE", 'success');
             } else {
                 $smarty->assign("T_WORKBOOK_MESSAGE", _WORKBOOK_SETTINGS_EDIT_PROBLEM);
                 $smarty->assign("T_WORKBOOK_MESSAGE_TYPE", 'failure');
             }
         }
         $renderer = new HTML_QuickForm_Renderer_ArraySmarty($smarty);
         $renderer->setRequiredTemplate('{$html}{if $required}&nbsp;<span class="formRequired">*</span>{/if}');
         $form->setJsWarnings(_BEFOREJAVASCRIPTERROR, _AFTERJAVASCRIPTERROR);
         $form->setRequiredNote(_REQUIREDNOTE);
         $form->accept($renderer);
         $smarty->assign('T_WORKBOOK_EDIT_SETTINGS_FORM', $renderer->toArray());
     }
     if (isset($_GET['reuse_item']) && $_GET['reuse_item'] == '1') {
         if ($_SESSION['s_type'] != 'professor') {
//.........这里部分代码省略.........
开发者ID:kaseya-university,项目名称:efront,代码行数:101,代码来源:module_workbook.class.php

示例5: _validate

 private function _validate()
 {
     if ($this->action == TIP_FORM_ACTION_DELETE || $this->action == TIP_FORM_ACTION_CUSTOM) {
         // Special case: GET driven form
         $this->_form->freeze();
         return TIP::getGet('process', 'int') == 1;
     }
     // Add element and form rules
     isset($this->validator) && $this->_form->addFormRule($this->validator);
     foreach (array_keys($this->fields) as $id) {
         if ($this->_form->elementExists($id)) {
             $this->_addGuessedRules($id);
             $this->_addCustomRules($id);
         }
     }
     $stage_id = $this->id . '.stage';
     $last_stage = HTTP_Session2::get($stage_id);
     if (!$this->_form->isSubmitted() || isset($last_stage) && $last_stage < $this->_stage) {
         HTTP_Session2::set($stage_id, $this->_stage);
         $valid = false;
     } elseif (is_null($last_stage)) {
         // No last stage defined
         TIP::notifyError('double');
         $valid = null;
     } else {
         // Validation
         $this->_form->applyFilter('__ALL__', array('TIP', 'extendedTrim'));
         $valid = $this->_form->validate();
     }
     // Perform uploads (if needed)
     if (is_callable(array('HTML_QuickForm_attachment', 'doUploads'))) {
         HTML_QuickForm_attachment::doUploads($this->_form);
     }
     return $valid;
 }
开发者ID:BackupTheBerlios,项目名称:tip,代码行数:35,代码来源:form.php

示例6: EfrontCourse

         }
     }
     #cpp#endif
 } else {
     if ($_GET['op'] == 'course_rules') {
         $courseLessons = $currentCourse->getCourseLessons();
         if ($currentCourse->course['depends_on']) {
             try {
                 $dependsOn = new EfrontCourse($currentCourse->course['depends_on']);
                 $smarty->assign("T_DEPENDSON_COURSE", $dependsOn->course['name']);
             } catch (Exception $e) {
             }
         }
         $rules_form = new HTML_QuickForm("course_rules_form", "post", basename($_SERVER['PHP_SELF']) . "?" . $baseUrl . "&op=course_rules", "", null, true);
         if (isset($currentUser->coreAccess['course_settings']) && $currentUser->coreAccess['course_settings'] != 'change') {
             $rules_form->freeze();
         } else {
             $rules_form->addElement('submit', 'submit_rule', _SUBMIT, 'class = "flatButton"');
             if ($rules_form->isSubmitted() && $rules_form->validate()) {
                 foreach ($_POST['rules'] as $rule_lesson) {
                     if (sizeof(array_unique($rule_lesson['lesson'])) != sizeof($rule_lesson['lesson'])) {
                         $duplicate = true;
                     }
                 }
                 if (!isset($duplicate)) {
                     try {
                         $currentCourse->rules = $_POST['rules'];
                         $currentCourse->persist();
                         eF_redirect("" . basename($_SERVER['PHP_SELF']) . "?" . $baseUrl . "&op=course_rules&message=" . urlencode(_SUCCESFULLYSETORDER) . "&message_type=success");
                     } catch (Exception $e) {
                         $smarty->assign("T_EXCEPTION_TRACE", $e->getTraceAsString());
开发者ID:kaseya-university,项目名称:efront,代码行数:31,代码来源:course_settings.php

示例7: array

$generalSMTPForm->registerRule('checkParameter', 'callback', 'eF_checkParameter');
$generalSMTPForm->addElement("text", "system_email", _SYSTEMEMAIL, 'class = "inputText"');
$generalSMTPForm->addElement("text", "smtp_host", _SMTPSERVER, 'class = "inputText"');
$generalSMTPForm->addElement("static", "", _IFUSESSLTHENPHPOPENSSL);
$generalSMTPForm->addElement("text", "smtp_user", _SMTPUSER, 'class = "inputText"');
$generalSMTPForm->addElement("password", "smtp_pass", _SMTPPASSWORD, 'class = "inputText"');
$generalSMTPForm->addElement("text", "smtp_port", _SMTPPORT, 'class = "inputText"');
$generalSMTPForm->addElement("text", "smtp_timeout", _SMTPTIMEOUT, 'class = "inputText"');
$generalSMTPForm->addElement("advcheckbox", "smtp_auth", _SMTPAUTH, null, 'class = "inputCheckBox"', array(0, 1));
$generalSMTPForm->setDefaults($GLOBALS['configuration']);
$generalSMTPForm->addRule('system_email', _INVALIDFIELDDATA, 'checkParameter', 'email');
$generalSMTPForm->addRule('system_email', _THEFIELD . ' ' . _SYSTEMEMAIL . ' ' . _ISMANDATORY, 'required', null, 'client');
$generalSMTPForm->addRule('smtp_port', _INVALIDFIELDDATA, 'checkParameter', 'uint');
$generalSMTPForm->addRule('smtp_timeout', _INVALIDFIELDDATA, 'checkParameter', 'uint');
if (isset($currentUser->coreAccess['configuration']) && $currentUser->coreAccess['configuration'] != 'change') {
    $generalSMTPForm->freeze();
} else {
    $generalSMTPForm->addElement("submit", "check_smtp", _CHECKSETTINGS, 'class = "flatButton"');
    $generalSMTPForm->addElement("submit", "submit", _SAVE, 'class = "flatButton"');
    if ($generalSMTPForm->isSubmitted() && $generalSMTPForm->validate()) {
        $values = $generalSMTPForm->exportValues();
        unset($values['submit']);
        if (!isset($values['check_smtp'])) {
            foreach ($values as $key => $value) {
                $result = EfrontConfiguration::setValue($key, $value);
            }
            eF_redirect(basename($_SERVER['PHP_SELF']) . "?ctg=system_config&op=general&tab=smtp&message=" . urlencode(_SUCCESFULLYUPDATECONFIGURATION) . "&message_type=success");
        } else {
            $user_mail = eF_getTableData("users", "email", "login='" . $_SESSION['s_login'] . "'");
            $header = array('From' => $values['system_email'], 'To' => $user_mail[0]['email'], 'Subject' => 'Test email', 'Content-type' => 'text/plain;charset="UTF-8"', 'Content-Transfer-Encoding' => '7bit', 'Date' => date("r"));
            $smtp = Mail::factory('smtp', array('auth' => $values['smtp_auth'] ? true : false, 'host' => $values['smtp_host'], 'password' => $values['smtp_pass'], 'port' => $values['smtp_port'], 'username' => $values['smtp_user'], 'timeout' => $values['smtp_timeout'], 'localhost' => $_SERVER["HTTP_HOST"]));
开发者ID:bqq1986,项目名称:efront,代码行数:31,代码来源:general.php

示例8: assign

    $form->addElement('submit', 'submit_question_another', _SAVEQUESTIONANDCREATENEW, 'class = "flatButton"');
}
if (isset($currentQuestion)) {
    //If we are changing an existing question
    //pr($currentQuestion);
    $form->setDefaults(array('content_ID' => $currentQuestion->question['content_ID'], 'question_type' => $currentQuestion->question['type'], 'difficulty' => $currentQuestion->question['difficulty'], 'question_text' => $currentQuestion->question['text'], 'explanation' => $currentQuestion->question['explanation']));
    if ($currentQuestion->question['estimate']) {
        $interval = eF_convertIntervalToTime($currentQuestion->question['estimate']);
        $form->setDefaults(array('estimate_min' => $interval['minutes'], 'estimate_sec' => $interval['seconds']));
    }
    /*
    if ($currentQuestion -> question['type'] == "raw_text" && strpos($currentQuestion -> question['answer'],"<a href") !== false) {
    $smarty -> assign("T_HTML_ANSWER",$currentQuestion -> question['answer']);
    }
    */
    $form->freeze('question_type');
    //The question type cannot be changed
    $smarty->assign("T_HAS_EXPLANATION", $currentQuestion->question['explanation']);
    //If the question has an explanation, use this smarty tag to set explanation field to be visible by default.
}
switch ($_GET['question_type']) {
    //Depending on the question type, the user might have added new form fields. We need to recreate the form, in order to be able to handle them both in case of succes or failure.
    case 'multiple_one':
        if ($form->isSubmitted() || isset($currentQuestion)) {
            if (isset($currentQuestion) && !$form->isSubmitted()) {
                $values['multiple_one'] = array_values(unserialize($currentQuestion->question['options']));
                //We put array_values to make sure that the array starts from zero
                // Types are from K1-K4 for multiple_one
                //$qtype_ans = (sizeof($values['multiple_one']) < 6)?sizeof($values['multiple_one']):5;
                //$smarty -> assign("T_QUESTION_TYPE_CODE", "K" . ($qtype_ans-1));
                $values['correct_multiple_one'] = unserialize($currentQuestion->question['answer']);
开发者ID:jiangjunt,项目名称:efront_open_source,代码行数:31,代码来源:add_question.php

示例9: array

        $multipleLogins = array('global' => $values['global'] ? 1 : 0, 'user_types' => $values['user_types'], 'groups' => $values['groups']);
        EfrontConfiguration::setValue('multiple_logins', serialize($multipleLogins));
        eF_redirect(basename($_SERVER['PHP_SELF']) . "?ctg=system_config&op=user&tab=multiple_logins&message=" . urlencode(_SUCCESFULLYUPDATECONFIGURATION) . "&message_type=success");
    }
}
$smarty->assign("T_USER_MULTIPLE_LOGINS_FORM", $userMultipleLoginsForm->toArray());
$userWebserverAuthenticationForm = new HTML_QuickForm("user_webserver_authentication_form", "post", basename($_SERVER['PHP_SELF']) . "?ctg=system_config&op=user&tab=webserver_authentication", "", null, true);
$userWebserverAuthenticationForm->registerRule('checkParameter', 'callback', 'eF_checkParameter');
$userWebserverAuthenticationForm->addElement("advcheckbox", "webserver_auth", _WEBSERVERAUTHENTICATION, null, 'class = "inputCheckBox"', array(0, 1));
$userWebserverAuthenticationForm->addElement("advcheckbox", "webserver_registration", _WEBSERVERREGISTRATION, null, 'class = "inputCheckBox"', array(0, 1));
$userWebserverAuthenticationForm->addElement("text", "error_page", _ERRORPAGEFORINVALIDLOGIN, 'class = "inputText"');
$userWebserverAuthenticationForm->addElement("text", "unauthorized_page", _ERRORPAGEFORUNAUTHORIZED, 'class = "inputText"');
$userWebserverAuthenticationForm->addElement("text", "username_variable", _VARIABLEFORUSERNAME, 'class = "inputText"');
$userWebserverAuthenticationForm->addElement("text", "registration_file", _INCLUDEFILETHATHANDLESUSERCREATION, 'class = "inputText"');
eval('$usernameVar=' . $GLOBALS['configuration']['username_variable'] . ';');
$userWebserverAuthenticationForm->addRule('webserver_auth', str_replace(array("%x", "%y"), array($GLOBALS['configuration']['username_variable'], $_SESSION['s_login']), _VARIABLEMUSTCONTAINLOGIN), 'callback', create_function('$checkbox', "if (\$GLOBALS['usernameVar'] == \$_SESSION['s_login']) {return true;}"));
$userWebserverAuthenticationForm->setDefaults($GLOBALS['configuration']);
if (isset($currentUser->coreAccess['configuration']) && $currentUser->coreAccess['configuration'] != 'change') {
    $userWebserverAuthenticationForm->freeze();
} else {
    $userWebserverAuthenticationForm->addElement("submit", "submit", _SAVE, 'class = "flatButton"');
    if ($userWebserverAuthenticationForm->isSubmitted() && $userWebserverAuthenticationForm->validate()) {
        $values = $userWebserverAuthenticationForm->exportValues();
        unset($values['submit']);
        foreach ($values as $key => $value) {
            EfrontConfiguration::setValue($key, $value);
        }
        eF_redirect(basename($_SERVER['PHP_SELF']) . "?ctg=system_config&op=user&tab=webserver_authentication&message=" . urlencode(_SUCCESFULLYUPDATECONFIGURATION) . "&message_type=success");
    }
}
$smarty->assign("T_USER_WEBSERVER_AUTHENTICATION_FORM", $userWebserverAuthenticationForm->toArray());
开发者ID:jiangjunt,项目名称:efront_open_source,代码行数:31,代码来源:user.php

示例10: basename

 $externalFacebookForm = new HTML_QuickForm("external_fb_form", "post", basename($_SERVER['PHP_SELF']) . "?ctg=system_config&op=external&tab=facebook", "", null, true);
 $externalFacebookForm->registerRule('checkParameter', 'callback', 'eF_checkParameter');
 $externalFacebookForm->addElement("advcheckbox", "social_" . FB_FUNC_DATA_ACQUISITION, _FACEBOOKDATAACQUISITION, null, 'class = "inputCheckBox"', array(0, 1));
 $externalFacebookForm->addElement("advcheckbox", "social_" . FB_FUNC_LOGGING, _FACEBOOKEXTERNALLOGGING, null, 'class = "inputCheckBox"', array(0, 1));
 $externalFacebookForm->addElement("advcheckbox", "social_" . FB_FUNC_CONNECT, _FACEBOOKCONNECT, null, 'class = "inputCheckBox"', array(0, 1));
 $externalFacebookForm->addElement("text", "facebook_api_key", _FACEBOOKAPIKEY, 'class = "inputText"');
 $externalFacebookForm->addElement("text", "facebook_secret", _FACEBOOKSECRET, 'class = "inputText"');
 // Initialize values
 for ($i = 1; $i < $all_social_enabled_value; $i = $i << 1) {
     if ($i & $socialModulesActivated) {
         $externalFacebookForm->setDefaults(array('social_' . $i => 1));
     }
 }
 $externalFacebookForm->setDefaults(array("facebook_api_key" => $GLOBALS['configuration']['facebook_api_key'], "facebook_secret" => $GLOBALS['configuration']['facebook_secret']));
 if (isset($currentUser->coreAccess['configuration']) && $currentUser->coreAccess['configuration'] != 'change') {
     $externalFacebookForm->freeze();
 } else {
     $externalFacebookForm->addElement("submit", "submit", _SAVE, 'class = "flatButton"');
     if ($externalFacebookForm->isSubmitted() && $externalFacebookForm->validate()) {
         $values = $externalFacebookForm->exportValues();
         unset($values['submit']);
         EfrontConfiguration::setValue('facebook_api_key', $values['facebook_api_key']);
         unset($values['facebook_api_key']);
         EfrontConfiguration::setValue('facebook_secret', $values['facebook_secret']);
         unset($values['facebook_secret']);
         // Create the new binary map
         $socialModulesToBeActivated = 0;
         foreach ($values as $key => $value) {
             if ($value == 1) {
                 $socialModulesToBeActivated += intval(substr($key, 7));
             }
开发者ID:bqq1986,项目名称:efront,代码行数:31,代码来源:external.php

示例11: foreach

 //$form -> registerRule('checkNotExist', 'callback', 'eF_checkNotExist');
 $form->addElement('text', 'name', _TYPENAME, 'class = "inputText"');
 $form->addRule('name', _THEFIELD . ' ' . _TYPENAME . ' ' . _ISMANDATORY, 'required', null, 'client');
 //$form -> addRule('name', _INVALIDFIELDDATA, 'checkParameter', 'text');
 //$form -> addRule('name', _USERTYPE.' &quot;'.($form -> exportValue('name')).'&quot; '._ALREADYEXISTS, 'checkNotExist', 'user_type');
 $form->addElement('select', 'basic_user_type', _BASICUSERTYPE, $basicTypes, 'id="basic_user_type" class = "inputSelect" onchange = "location = \'administrator.php?ctg=user_types&' . $postTarget . '&basic_type=\'+this.options[this.selectedIndex].value+\'&name=\'+document.getElementsByName(\'name\')[0].value"');
 foreach ($options as $key => $value) {
     if ($key == 'module_itself' || $key == 'professor_courses' || $key == 'insert_group_key') {
         $form->addElement("select", "core_access[{$key}]", $value, array('change' => _CHANGE, 'hidden' => _HIDE));
     } else {
         $form->addElement("select", "core_access[{$key}]", $value, array('change' => _CHANGE, 'view' => _VIEW, 'hidden' => _HIDE));
     }
 }
 $form->setDefaults(array('basic_user_type' => $basicType, 'name' => $_GET['name']));
 if (isset($_GET['edit_user_type'])) {
     $form->freeze(array('basic_user_type'));
     $form->setDefaults(array('name' => $result[0]['name'], 'basic_user_type' => $result[0]['basic_user_type'], 'core_access' => unserialize($result[0]['core_access'])));
     $smarty->assign("T_USER_TYPE_NAME", $result[0]['name']);
 }
 if (isset($currentUser->coreAccess['user_types']) && $currentUser->coreAccess['user_types'] != 'change' || $currentUser->user['user_types_ID'] == $_GET['edit_user_type']) {
     $form->freeze();
 } else {
     $form->addElement('submit', 'submit_type', _SAVE, 'class = "flatButton"');
     if ($form->isSubmitted() && $form->validate()) {
         $values = $form->exportValues();
         $fields = array("name" => $values['name'], "basic_user_type" => $values['basic_user_type'], "core_access" => serialize($values['core_access']));
         if (isset($_GET['edit_user_type'])) {
             if (eF_updateTableData("user_types", $fields, "id=" . $_GET['edit_user_type'])) {
                 $message = _SUCCESFULLYUPDATEDUSERTYPE;
                 $message_type = 'success';
                 eF_redirect("" . basename($_SERVER['PHP_SELF']) . "?ctg=user_types&message=" . urlencode($message) . "&message_type=" . $message_type);
开发者ID:jiangjunt,项目名称:efront_open_source,代码行数:31,代码来源:user_types.php

示例12: getUploadForm

    /**
     * Get an upload form
     *
     * This function is responsible for creating an "upload file"
     * form, as well as the equivalent HTML code.
     * <br/>Example:
     * <code>
     * $basedir    = G_LESSONSPATH.'test/';
     * $filesystem = new FileSystemTree($basedir);									//Set the base directory that the file manager displayes
     * $url        = 'administrator.php?ctg=file_manager';			//Set the url where file manager resides
     * $uploadForm         = new HTML_QuickForm("upload_file_form", "post", $url, "", "", true);
     * $uploadFormString   = $filesystem -> getUploadForm($uploadForm);
     * echo $uploadFormString;
     * </code>
     *
     * @param HTML_QuickForm $form The form to populate
     * @return string The HTML code of the form
     * @since 3.5.0
     * @access public
     */
    public function getUploadForm(&$form)
    {
        $form->registerRule('checkParameter', 'callback', 'eF_checkParameter');
        //Register this rule for checking user input with our function, eF_checkParameter
        $form->addElement('file', 'file_upload[0]', null, 'class = "inputText"');
        $form->addElement('file', 'file_upload[1]', null, 'class = "inputText"');
        $form->addElement('file', 'file_upload[2]', null, 'class = "inputText"');
        $form->addElement('file', 'file_upload[3]', null, 'class = "inputText"');
        $form->addElement('file', 'file_upload[4]', null, 'class = "inputText"');
        $form->addElement('file', 'file_upload[5]', null, 'class = "inputText"');
        $form->addElement('file', 'file_upload[6]', null, 'class = "inputText"');
        $form->addElement('advcheckbox', 'overwrite', _OVERWRITE, null, 'class = "inputCheckbox"' . $readonly);
        if ($_SESSION['s_type'] == 'student') {
            $form->freeze('overwrite');
        } else {
            $form->setDefaults(array('overwrite' => '0'));
        }
        $form->addElement('text', 'url_upload', null, 'id = "url_upload" class = "inputText"');
        $form->addElement('hidden', 'upload_current_directory', null, 'id = "upload_current_directory" class = "inputText"');
        $form->addElement('submit', 'submit_upload_file', _UPLOAD, 'class = "flatButton" onclick = "$(\'uploading_image\').show()"');
        $form->setMaxFileSize($this->getUploadMaxSize() * 1024);
        //getUploadMaxSize returns size in KB
        $renderer = new HTML_QuickForm_Renderer_ArraySmarty($smarty);
        $form->accept($renderer);
        $formArray = $renderer->toArray();
        $formString = '
	    			' . $formArray['javascript'] . '
	    			<form ' . $formArray['attributes'] . '>
	    			' . $formArray['hidden'] . '
	    			<table width = "100%">
		            	<tr><td class = "labelCell">' . _UPLOADFILE . ':&nbsp;</td>
		            		<td class = "elementCell">' . $formArray['file_upload'][0]['html'] . '</td></tr>
		            	<tr style = "display:none"><td class = "labelCell">' . _UPLOADFILE . ':&nbsp;</td>
		            		<td class = "elementCell">' . $formArray['file_upload'][1]['html'] . '</td></tr>
		            	<tr style = "display:none"><td class = "labelCell">' . _UPLOADFILE . ':&nbsp;</td>
		            		<td class = "elementCell">' . $formArray['file_upload'][2]['html'] . '</td></tr>
		            	<tr style = "display:none"><td class = "labelCell">' . _UPLOADFILE . ':&nbsp;</td>
		            		<td class = "elementCell">' . $formArray['file_upload'][3]['html'] . '</td></tr>
		            	<tr style = "display:none"><td class = "labelCell">' . _UPLOADFILE . ':&nbsp;</td>
		            		<td class = "elementCell">' . $formArray['file_upload'][4]['html'] . '</td></tr>
		            	<tr style = "display:none"><td class = "labelCell">' . _UPLOADFILE . ':&nbsp;</td>
		            		<td class = "elementCell">' . $formArray['file_upload'][5]['html'] . '</td></tr>
		            	<tr style = "display:none"><td class = "labelCell">' . _UPLOADFILE . ':&nbsp;</td>
		            		<td class = "elementCell">' . $formArray['file_upload'][6]['html'] . '</td></tr>
		            	<tr style = "display:none"><td class = "labelCell">' . _UPLOADFILE . ':&nbsp;</td>	
		            	<tr><td></td>
		            		<td class = "elementCell">
		            			<img src = "images/16x16/add.png" alt = "' . _ADDFILE . '" title = "' . _ADDFILE . '" onclick = "addUploadBox(this)"/></td></tr>
		            	<tr><td></td>
		            		<td class = "infoCell"><span id="messageError" class = "severeWarning"></span></td></tr>
						<tr><td></td>
		            		<td class = "infoCell">' . _MAXIMUMUPLOADSIZE . ': ' . $this->getUploadMaxSize() . ' ' . _KB . '</td></tr>
		            	<tr><td class = "labelCell">' . _UPLOADFILEFROMURL . ':&nbsp;</td>
		            		<td class = "elementCell">' . $formArray['url_upload']['html'] . '</td></tr>
		            	<tr><td class = "labelCell">' . $formArray['overwrite']['label'] . ':&nbsp;</td>
		            		<td class = "elementCell">' . $formArray['overwrite']['html'] . '</td></tr>	
		            	<tr><td></td>
		            		<td class = "submitCell">
	            				' . $formArray['submit_upload_file']['html'] . '
	            			</td></tr>

	            	</table>
	            	</form>
	            	<img src = "images/others/progress_big.gif" id = "uploading_image" title = "' . _UPLOADING . '" alt = "' . _UPLOADING . '" style = "display:none;margin-left:auto;margin-right:auto;margin-top:30px;vertical-align:middle;"/>';
        return $formString;
    }
开发者ID:jiangjunt,项目名称:efront_open_source,代码行数:86,代码来源:filesystem.class.php

示例13: unset

}
#cpp#endif
if (G_VERSIONTYPE != 'community') {
    #cpp#ifndef COMMUNITY
    $modeForm->addElement("static", "separator", '<span style="font-weight:bold">' . _SOCIALOPTIONS . '</span>');
    //$modeForm -> addElement("select", "mode_social_events",  _EVENTSLOGGING, $modes);
    $modeForm->addElement("select", "mode_system_timeline", _SYSTEMTIMELINES, $modes);
    $modeForm->addElement("select", "mode_lessons_timeline", _LESSONTIMELINES, $modes);
    $modeForm->addElement("select", "mode_func_people", _PEOPLECONNECTIONS, $modes);
    $modeForm->addElement("select", "mode_func_comments", _COMMENTSWALL, $modes);
    $modeForm->addElement("select", "mode_func_userstatus", _USERSTATUS, $modes);
}
#cpp#endif
$modeForm->setDefaults($GLOBALS['configuration']);
if (isset($currentUser->coreAccess['configuration']) && $currentUser->coreAccess['configuration'] != 'change') {
    $modeForm->freeze();
} else {
    $modeForm->addElement("submit", "submit", _SAVE, 'class = "flatButton"');
    if ($modeForm->isSubmitted() && $modeForm->validate()) {
        //If the form is submitted and validated
        $values = $modeForm->exportValues();
        unset($values['submit']);
        foreach ($values as $key => $value) {
            EfrontConfiguration::setValue($key, $value);
        }
        //@TODO review by mixalis
        /*
        		$socialModulesToBeActivated = 
        		EfrontUser::isOptionVisible('system_timeline') &
        		EfrontUser::isOptionVisible('lessons_timeline') &
        		EfrontUser::isOptionVisible('func_people') &
开发者ID:jiangjunt,项目名称:efront_open_source,代码行数:31,代码来源:customization.php

示例14: EfrontUnit

    $form->setDefaults(array('action_on_submit' => 5, 'maintain_history' => 5, 'publish' => 1, 'keep_best' => 0, 'mastery_score' => $_GET['ctg'] != 'feedback' ? 50 : 0, 'redoable' => 1));
    if (isset($_GET['from_unit'])) {
        $form->setDefaults(array('parent_content' => $_GET['from_unit']));
    }
} else {
    if (isset($_GET['edit_test'])) {
        if (!$skillgap_tests) {
            $testUnit = new EfrontUnit($currentTest->test['content_ID']);
        }
        if ($_GET['ctg'] != 'feedback') {
            $form->addElement('submit', 'submit_test', _SAVETEST, 'class = "flatButton"');
            $form->addElement('submit', 'submit_test_new', _SAVEASNEWTEST, 'class = "flatButton"');
        } else {
            $form->addElement('submit', 'submit_test', _SAVE, 'class = "flatButton"');
        }
        $form->freeze('parent_content');
        $form->setDefaults($currentTest->options);
        if ($currentTest->options['redirect']) {
            $submitaction = 0;
        } elseif ($currentTest->options['show_answers_if_pass']) {
            $submitaction = 5;
        } elseif ($currentTest->options['answers']) {
            $submitaction = 4;
        } elseif ($currentTest->options['show_score']) {
            $submitaction = 3;
        } elseif ($currentTest->options['given_answers']) {
            $submitaction = 2;
        } else {
            $submitaction = 1;
        }
        $form->setDefaults(array('name' => $currentTest->test['name'], 'duration' => $currentTest->options['duration'] ? round($currentTest->options['duration'] / 60) : '', 'redoable' => $currentTest->options['redoable'] ? $currentTest->options['redoable'] : '', 'publish' => $currentTest->test['publish'], 'keep_best' => $currentTest->test['keep_best'], 'description' => $currentTest->test['description'], 'action_on_submit' => $submitaction, 'mastery_score' => $currentTest->test['mastery_score']));
开发者ID:jiangjunt,项目名称:efront_open_source,代码行数:31,代码来源:add_test.php

示例15: EfrontFile

         try {
             $pdfFile = new EfrontFile($pdfId[1]);
         } catch (Exception $e) {
             $smarty->assign("T_EXCEPTION_TRACE", $e->getTraceAsString());
             $message = _SOMEPROBLEMOCCURED . ': ' . $e->getMessage() . ' (' . $e->getCode() . ') &nbsp;<a href = "javascript:void(0)" onclick = "eF_js_showDivPopup(event, \'' . _ERRORDETAILS . '\', 2, \'error_details\')">' . _MOREINFO . '</a>';
             $message_type = 'failure';
         }
         $form->setDefaults(array('pdf_content' => $pdfFile['physical_name']));
     }
     $form->setDefaults(array('pdf_check' => 1));
     $smarty->assign("T_EDITPDFCONTENT", true);
 }
 //You can't change a unit's parent from this form. You must use the content tree management page
 if ($_GET['edit']) {
     $form->setDefaults(array('parent_content_ID' => $currentUnit['parent_content_ID']));
     $form->freeze(array('parent_content_ID'));
 }
 //If the form was submitted with pdf content, take special care
 if ($form->isSubmitted() && $form->validate()) {
     try {
         $values = $form->exportValues();
         if ($_FILES['pdf_upload']['name'] != "") {
             if (strpos($_FILES['pdf_upload']['name'], ".pdf") !== false) {
                 $destinationDir = new EfrontDirectory(G_LESSONSPATH . $_SESSION['s_lessons_ID']);
                 $filesystem = new FileSystemTree(G_LESSONSPATH . $_SESSION['s_lessons_ID']);
                 $uploadedFile = $filesystem->uploadFile('pdf_upload', $destinationDir);
                 $values['data'] = '<iframe src="view_file.php?file=' . $uploadedFile['id'] . '"  name="pdfaccept" width="100%" height="600"></iframe>';
                 //$values['data'] = '<iframe src="'.$currentLesson -> getDirectoryUrl().'/'.$uploadedFile["physical_name"].'"  name="pdfaccept" width="100%" height="600"></iframe>';
             } else {
                 throw new Exception(_YOUMUSTUPLOADAPDFFILE);
             }
开发者ID:jiangjunt,项目名称:efront_open_source,代码行数:31,代码来源:common_content.php


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