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


PHP HTML_QuickForm::accept方法代码示例

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


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

示例1: __construct

 public function __construct()
 {
     parent::__construct('delete_interest', 'Delete Interest', 'Admin/delete_interest.php');
     if ($this->loginError) {
         return;
     }
     $form = new HTML_QuickForm('deleter');
     $interest_list = new pdAuthInterests($this->db);
     $form->addElement('select', 'interests', 'Select interest(s) to delete:', $interest_list->list, array('multiple' => 'multiple', 'size' => 15));
     $form->addGroup(array(HTML_QuickForm::createElement('button', 'cancel', 'Cancel', array('onclick' => 'history.back()')), HTML_QuickForm::createElement('submit', 'submit', 'Delete')), null, null, ' ', false);
     if ($form->validate()) {
         $values = $form->exportValues();
         foreach ($values['interests'] as $interest_id) {
             $names[] = $interest_list->list[$interest_id];
         }
         $interest_list->dbDelete($this->db, $values['interests']);
         echo 'You have successfully removed the following interest from the ', 'database: <br/><b>', implode(', ', $names), '</b></p>', '<br><a href="', $_SERVER['PHP_SELF'], '">Delete another interest</a>';
     } else {
         $renderer =& $form->defaultRenderer();
         $form->accept($renderer);
         $this->form =& $form;
         $this->renderer =& $renderer;
         echo '<h3>Delete Interest </h3>';
     }
 }
开发者ID:papersdb,项目名称:papersdb,代码行数:25,代码来源:delete_interest.php

示例2: __construct

 public function __construct()
 {
     parent::__construct('aicml_stats');
     if ($this->loginError) {
         return;
     }
     $this->loadHttpVars(true, false);
     if (isset($this->csv_output)) {
         assert('isset($_SESSION["aicml_stats"])');
         $this->stats =& $_SESSION['aicml_stats'];
         return;
     }
     $pubs =& $this->getMachineLearningPapers();
     // populate $this->aicml_pi_authors
     $this->getPiAuthors();
     // populate $this->aicml_pdf_students_staff_authors
     $this->getPdfStudentsAndStaffAuthors();
     $this->collectStats($pubs);
     $_SESSION['aicml_stats'] =& $this->stats;
     $form = new HTML_QuickForm('aicml_stats', 'get', 'aicml_stats.php');
     $form->addElement('submit', 'csv_output', 'Export to CSV');
     // create a new renderer because $form->defaultRenderer() creates
     // a single copy
     $renderer = new HTML_QuickForm_Renderer_Default();
     $form->accept($renderer);
     echo $renderer->toHtml();
     echo $this->allPiPublicationTable();
     echo $this->fiscalYearTotalsTable('pi', 'PI Fiscal Year Totals');
     foreach ($this->aicml_pi_authors as $pi_author) {
         echo $this->piPublicationsTable($pi_author);
     }
     echo $this->staffPublicationsTable();
     echo $this->fiscalYearTotalsTable('staff', 'Staff Fiscal Year Totals');
     echo $this->studentTotalsTable();
 }
开发者ID:papersdb,项目名称:papersdb,代码行数:35,代码来源:aicml_stats.php

示例3: toSmarty

 /**
  * 
  * @return array
  */
 public function toSmarty()
 {
     $this->formRenderer = new \HTML_QuickForm_Renderer_ArraySmarty($this->tpl, true);
     $this->formRenderer->setRequiredTemplate('{label}<font color="red" size="1">*</font>');
     $this->formRenderer->setErrorTemplate('<font color="red">{error}</font><br />{html}');
     $this->formProcessor->accept($this->formRenderer);
     $smartyArrayFormat = $this->formatForSmarty();
     $this->tpl->assign('eventValidation', $this->eventValidation);
     $this->tpl->assign('submitValidation', $this->submitValidation);
     return $smartyArrayFormat;
 }
开发者ID:rk4an,项目名称:centreon,代码行数:15,代码来源:Form.php

示例4: __construct

 public function __construct()
 {
     parent::__construct('view_publication', 'View Publication', 'view_publication.php');
     if ($this->loginError) {
         return;
     }
     $this->loadHttpVars();
     if (!isset($this->pub_id) || !is_numeric($this->pub_id)) {
         $this->pageError = true;
         return;
     }
     $pub = new pdPublication();
     $result = $pub->dbLoad($this->db, $this->pub_id);
     if (!$result) {
         echo 'Publication does not exist';
         return;
     }
     if (isset($this->submit_pending) && $this->submit_pending) {
         // check if this pub entry is pending
         $q = $this->db->selectRow('pub_pending', '*', array('pub_id' => $this->pub_id));
         assert('$q');
         $form = new HTML_QuickForm('submit_pending');
         $form->addElement('hidden', 'submit_pending', true);
         $form->addElement('hidden', 'pub_id', $this->pub_id);
         $elements = array();
         $elements[] = HTML_QuickForm::createElement('advcheckbox', 'valid', null, 'Valid', null, array(0, 1));
         $elements[] = HTML_QuickForm::createElement('submit', 'submit', 'Submit');
         $form->addGroup($elements, 'elgroup', '', '&nbsp', false);
         // create a new renderer because $form->defaultRenderer() creates
         // a single copy
         $renderer = new HTML_QuickForm_Renderer_Default();
         $form->accept($renderer);
         if ($form->validate()) {
             $values =& $form->exportValues();
             $pub->markValid($this->db);
             echo 'Publication entry marked as valid.';
             return;
         } else {
             echo "<h2>This publication entry requires validation</h2>\n";
             echo $renderer->toHtml();
         }
     }
     $this->showPublication($pub);
 }
开发者ID:papersdb,项目名称:papersdb,代码行数:44,代码来源:view_publication.php

示例5: __construct

 public function __construct()
 {
     parent::__construct('tag_non_ml');
     if ($this->loginError) {
         return;
     }
     $this->loadHttpVars();
     $pubs =& $this->getNonMachineLearningPapers();
     $form = new HTML_QuickForm('tag_non_ml_form', 'post', './tag_ml_submit.php');
     $form->addElement('header', null, 'Citation</th><th style="width:7%">Is ML');
     $count = 0;
     foreach ($pubs as &$pub) {
         $pub->dbLoad($this->db, $pub->pub_id, pdPublication::DB_LOAD_VENUE | pdPublication::DB_LOAD_CATEGORY | pdPublication::DB_LOAD_AUTHOR_FULL);
         ++$count;
         $form->addGroup(array(HTML_QuickForm::createElement('static', null, null, $pub->getCitationHtml() . '&nbsp;' . getPubIcons($this->db, $pub, 0x7)), HTML_QuickForm::createElement('advcheckbox', 'pub_tag[' . $pub->pub_id . ']', null, null, null, array('no', 'yes'))), 'tag_ml_group', $count, '</td><td>', false);
     }
     $form->addElement('submit', 'submit', 'Submit');
     $renderer =& $form->defaultRenderer();
     $form->accept($renderer);
     $this->renderer =& $renderer;
 }
开发者ID:papersdb,项目名称:papersdb,代码行数:21,代码来源:tag_non_ml.php

示例6: ic2g_onload

    $flexy->setData('images', $images);
    if ($isPopUp) {
        $flexy->setData('showForm', true);
    }
} else {
    if (empty($isError) || $isPopUp) {
        $flexy->setData('showForm', true);
    }
}
// }}}
// {{{ output
// フォームをテンプレート用オブジェクトに変換
$r = new HTML_QuickForm_Renderer_ObjectFlexy($flexy);
//$r->setLabelTemplate('_label.tpl.html');
//$r->setHtmlTemplate('_html.tpl.html');
$qf->accept($r);
$qfObj = $r->toObject();
// 動的JavaScript
$js = $qf->getValidationScript();
$js .= <<<EOS
<script type="text/javascript">
// <![CDATA[
function ic2g_onload()
{
\tsetWinTitle();

EOS;
if ($execDL && $autoClose > 0) {
    $js .= "\twindow.setTimeout('window.close();', {$autoClose});\n";
}
$js .= <<<EOS
开发者ID:xingskycn,项目名称:p2-php,代码行数:31,代码来源:ic2_getter.php

示例7: basename

$importForm->accept($renderer);
$smarty->assign('T_IMPORT_FORM', $renderer->toArray());
// ******************************************* Export form *******************************************
$exportForm = new HTML_QuickForm("export_form", "post", basename($_SERVER['PHP_SELF']) . "?ctg=import_export&op=export&tab=export", "", null, true);
unset($import_export_types['anything']);
$exportForm->addElement('select', 'export_type', _DATATYPE, $import_export_types, 'class = "inputCheckbox"', array(0, 1));
$exportForm->addElement("select", "date_format", _DATEFORMAT, array("DD/MM/YYYY" => "DD/MM/YYYY", "MM/DD/YYYY" => "MM/DD/YYYY", "YYYY/MM/DD" => "YYYY/MM/DD"));
$exportForm->addElement('radio', 'export_separator', _KEEPEXISTINGUSERS, null, 'csvA');
$exportForm->addElement('radio', 'export_separator', _KEEPEXISTINGUSERS, null, 'csvB');
$exportForm->setDefaults(array('export_separator' => "csvA"));
$exportForm->addElement('submit', 'submit_export', _EXPORTDATA, 'class = "flatButton"');
if ($exportForm->isSubmitted() && $exportForm->validate()) {
    $exportForm->exportValue('export_separator') == 'csvA' ? $separator = ',' : ($separator = ';');
    try {
        $options = array("separator" => $separator, "date_format" => $exportForm->exportValue('date_format'));
        $exporter = EfrontExportFactory::factory("csv", $options);
        $file = $exporter->export($exportForm->exportValue('export_type'));
        header("content-type:" . $file['mime_type']);
        header('content-disposition: attachment; filename= "' . $file['name'] . '"');
        readfile($file['path']);
        exit;
    } catch (Exception $e) {
        $smarty->assign("T_EXCEPTION_TRACE", $e->getTraceAsString());
        $message = _ERRORRESTORINGFILE . ': ' . $e->getMessage() . ' (' . $e->getCode() . ') &nbsp;<a href = "javascript:void(0)" onclick = "eF_js_showDivPopup(event, \'' . _ERRORDETAILS . '\', 2, \'error_details\')">' . _MOREINFO . '</a>';
        $message_type = 'failure';
    }
    //$smarty -> assign("T_EXPORTED_FILE", $file);
}
$renderer = new HTML_QuickForm_Renderer_ArraySmarty($smarty);
$exportForm->accept($renderer);
$smarty->assign('T_EXPORT_FORM', $renderer->toArray());
开发者ID:kaseya-university,项目名称:efront,代码行数:31,代码来源:import_export.php

示例8: getSmartyTpl

 public function getSmartyTpl()
 {
     $smarty = $this->getSmartyVar();
     $smarty->assign('T_CHAT_ERROR_RATE', "");
     $smarty->assign('T_CHAT_ERROR2_RATE', "");
     if (isset($_POST['rate']) && isset($_POST['rate2'])) {
         $ok = true;
         if ($_POST['rate'] < 1) {
             $smarty->assign('T_CHAT_ERROR_RATE', " New Rate must be greater or equal to 1.");
             $ok = false;
         }
         if ($_POST['rate2'] < 1) {
             $smarty->assign('T_CHAT_ERROR2_RATE', " New Rate must be greater or equal to 1.");
             $ok = false;
         }
         if ($ok) {
             $this->setChatHeartbeat($_POST['rate'] * 1000);
             $this->setRefresh_rate($_POST['rate2'] * 1000);
         }
     }
     $r = $this->getChatHeartbeat();
     $r2 = $this->getRefresh_rate();
     $smarty->assign('T_CHAT_CURRENT_RATE', $r / 1000);
     $form = new HTML_QuickForm("change_chatheartbeat_form", "post", $this->moduleBaseUrl . "&setChatHeartBeat=1", "", null, true);
     $form->addElement('text', 'rate', "rate", 'class="inputText" value="' . $r / 1000 . '" style="width:100px;"');
     $form->addRule('rate', _THEFIELD . ' "Rate" ' . _ISMANDATORY, 'required', null, 'client');
     $form->addRule('rate', "Non numeric Value", 'numeric', null, 'client');
     $form->addRule('rate', "Rate must be greater than 1", 'callback', create_function('$rate', 'return ($rate >= 1);'));
     $form->addElement('text', 'rate2', "rate2", 'class="inputText" value="' . $r2 / 1000 . '" style="width:100px;"');
     $form->addRule('rate2', _THEFIELD . ' "Rate" ' . _ISMANDATORY, 'required', null, 'client');
     $form->addRule('rate2', "Non numeric Value", 'numeric', null, 'client');
     $form->addElement('submit', 'submit1', _SUBMIT, 'class="flatButton"');
     $renderer = new HTML_QuickForm_Renderer_ArraySmarty($smarty);
     $form->setJsWarnings(_BEFOREJAVASCRIPTERROR, _AFTERJAVASCRIPTERROR);
     $form->setRequiredNote("mesh");
     $form->accept($renderer);
     $smarty->assign('T_CHAT_CHANGE_CHATHEARTBEAT_FORM', $renderer->toArray());
     ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     /*$smarty->assign('T_CHAT_ERROR2_RATE', "");
     			
     			if (isset($_POST['rate2'])){
     				if ($_POST['rate2'] >= 1)
     					$this -> setRefresh_rate($_POST['rate2']*1000);
     				else
     					$smarty->assign('T_CHAT_ERROR2_RATE', " New Rate must be greater or equal to 1.");
     			}
     
     			$r2 = $this->getRefresh_rate();
     
     			$smarty->assign('T_CHAT_CURRENT_REFRESH_RATE', $r2/1000);
     
     			$form = new HTML_QuickForm("change_refreshrate_form", "post", $this->moduleBaseUrl."&setRefresh_rate=1", "", null, true);
     			$form->addElement('text', 'rate2', "rate2", 'class="inputText" value="'.($r2/1000).'" style="width:100px;"');
     			$form->addRule('rate2', _THEFIELD.' "New Rate" '._ISMANDATORY, 'required', null, 'client');
     			$form->addRule('rate2', "Non numeric Value", 'numeric', null, 'client');
     			$form->addElement('submit', 'submit2', _SUBMIT, 'class="flatButton"');
     			$renderer = new HTML_QuickForm_Renderer_ArraySmarty($smarty);
     			$form->setJsWarnings(_BEFOREJAVASCRIPTERROR, _AFTERJAVASCRIPTERROR);
     			$form->setRequiredNote("mesh");
     			$form->accept($renderer);
     			$smarty->assign('T_CHAT_CHANGE_REFRESHRATE_FORM', $renderer->toArray());*/
     /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     //$lessons = $this -> getLessonsCatalogue();
     //$smarty->assign('T_CHAT_LESSONS', $lessons);
     $textfieldcontent = "";
     if (isset($_POST['lessontitle'])) {
         $textfieldcontent = $_POST['lessontitle'];
         //$l = strip_tags($_POST['lessontitle']);
         //$l2 = substr($l, strpos($l, '→')+5);
         $log = $this->createLessonHistory($_POST['lessontitle'], $_POST['from']['Y'] . '-' . $_POST['from']['M'] . '-' . $_POST['from']['d'] . ' ' . "00:00:00", $_POST['until']['Y'] . '-' . $_POST['until']['M'] . '-' . $_POST['until']['d'] . ' ' . "23:59:59");
         $smarty->assign('T_LOG', $log);
         $smarty->assign('T_CHAT_LESSON_TITLE', $l2);
     }
     $form = new HTML_QuickForm("create_log_form", "post", $this->moduleBaseUrl . "&createLog=1", "", null, true);
     $date_from = $form->addElement('date', 'from', 'From Date:', array('format' => 'dMY', 'minYear' => 2010, 'maxYear' => date('Y')));
     $date_until = $form->addElement('date', 'until', 'Until Date:', array('format' => 'dMY', 'minYear' => 2010, 'maxYear' => date('Y')));
     $form->addElement('text', 'lessontitle', "lessontitle", 'maxlength="100" size="100" class="autoCompleteTextBox" id="autocomplete" value="' . $textfieldcontent . '"');
     $form->addRule('lessontitle', _THEFIELD . ' "Lesson Title" ' . _ISMANDATORY, 'required', null, 'client');
     $week_ago = $this->subtractDaysFromToday(7);
     $form->setDefaults(array('until' => array('d' => date('d'), 'M' => date('m'), 'Y' => date('Y')), 'from' => $week_ago));
     $form->addElement('submit', 'submit', "Create Log", 'class="flatButton"');
     $renderer = new HTML_QuickForm_Renderer_ArraySmarty($smarty);
     $form->setJsWarnings(_BEFOREJAVASCRIPTERROR, _AFTERJAVASCRIPTERROR);
     $form->setRequiredNote("mesh");
     $form->accept($renderer);
     $smarty->assign('T_CHAT_CREATE_LOG_FORM', $renderer->toArray());
     ////////
     return $this->moduleBaseDir . "control_panel.tpl";
 }
开发者ID:kaseya-university,项目名称:efront,代码行数:89,代码来源:module_chat.class.php

示例9: _customDisplay

    /**
     * Remplit le layer de customisation des searchforms.
     *
     * @param object $tpl instanceof Template
     * @access private
     * @return void
     */
    private function _customDisplay($tpl)
    {
        require_once 'HTML/QuickForm.php';
        require_once 'HTML/QuickForm/Renderer/ArraySmarty.php';
        require_once 'HTML/QuickForm/advmultiselect.php';
        $renderer = new HTML_QuickForm_Renderer_ArraySmarty($tpl);
        $form = new HTML_QuickForm('CustomSearch', 'post', $_SERVER['PHP_SELF']);
        $form->removeAttribute('name');
        // XHTML compliance
        $defaultValues = array();
        // Valeurs par defaut des champs du form
        $form->updateAttributes(array('onsubmit' => "return checkBeforeSubmit();"));
        $form->addElement('hidden', 'customSearchUpdated', '0');
        $criteria = array();
        foreach ($this->_elementsToDisplay as $elementName => $type) {
            if ($type == 'blank' || substr($type, 0, 4) == 'date') {
                continue;
            }
            $criteria[$elementName] = $this->_form->getElement($elementName)->getLabel();
        }
        $labels = array(_('criteria') . ':', _('Available criteria'), _('Criteria to hide'));
        $elt = HTML_QuickForm::createElement('advmultiselect', 'customSearchHiddenCriteria', $labels, $criteria, array('style' => 'width:100%;'));
        // Necessaire pour externaliser la tonne de js, si include js trouve
        $js = file_exists('JS_AdvMultiSelect.php') ? '' : '{javascript}';
        $jsValidation = '<script type="text/javascript">
                //<![CDATA[
            function checkBeforeSubmit() {
                if ($(\'__customSearchHiddenCriteria\').options.length == 0) {
                    alert("' . _("You can't hide all criteria.") . '");
                    return false;
                }
                return true;
            }

            //]]>
             </script>';
        $eltTemplate = $js . $jsValidation . '
            <table{class}>
              <tr><th>{label_2}</th><th>&nbsp;</th><th>{label_3}</th></tr>
            <tr>
              <td valign="top">{unselected}</td>
              <td align="center">{add}{remove}</td>
              <td valign="top">{selected}</td>
            </tr>
            </table>
            ';
        $elt->setElementTemplate($eltTemplate);
        $form->addElement($elt);
        $form->addElement('submit', 'customSearchSubmit', A_VALIDATE, 'onclick="this.form.customSearchUpdated.value=1;"');
        $form->addElement('button', 'customSearchCancel', A_CANCEL, 'onclick="fw.dom.toggleElement($(\'custom_search_layer\'));"');
        $defaultValues['customSearchHiddenCriteria'] = $this->hiddenCriteriaByUser;
        $form->setDefaults($defaultValues);
        // PATCH car advmultiselect buggé!!
        $elt->_values = $defaultValues['customSearchHiddenCriteria'];
        // end PATCH
        $form->accept($renderer);
        // affecte au form le renderer personnalise
        $tpl->assign('customSearchForm', $renderer->toArray());
    }
开发者ID:arhe,项目名称:pwak,代码行数:66,代码来源:SearchForm.php

示例10: array

 function db2app()
 {
     require_once 'HTML/QuickForm.php';
     $form = new HTML_QuickForm('db2app');
     $res = mysql_list_dbs(db());
     if (!$res) {
         trigger_error(mysql_error(db()), E_USER_ERROR);
     }
     $options = array('' => 'Please Select Database ...');
     while ($row = mysql_fetch_row($res)) {
         $options[$row[0]] = $row[0];
     }
     $form->addElement('hidden', '-action', 'db2app');
     $form->addElement('select', 'database_name', 'Select Database' . $this->infoLink('archive2app.database_name'), $options, array('onchange' => 'listeners.database_name.onchange(this)'));
     $form->addElement('header', 'db_info', 'Database connection details');
     //$form->addElement('html', 'this is a test');
     $form->addElement('text', 'mysql_user', 'MySQL Username ' . $this->infoLink('archive2app.mysql_user'));
     $form->addElement('password', 'mysql_password', 'MySQL Password');
     //$form->addElement('radio','output_format','Output options','Download as tar.gz archive','download');
     //$form->addElement('radio','output_format','','Install on webserver in apps directory','install');
     $form->addElement('select', 'install_type', 'Installation type ' . $this->infoLink('archive2app.install_type'), array('' => 'Please select ...', 'download_tarball' => 'Download Tarball', 'ftp_install' => 'Install on server (using FTP)'), array('onchange' => "listeners.install_type.onchange(this);"));
     $form->addElement('header', 'ftp_info', 'FTP Connection Info');
     $form->addElement('text', 'ftp_host', 'FTP Host');
     $form->addElement('checkbox', 'ftp_ssl', 'Use SSL');
     $form->setDefaults(array('ftp_host' => DB_HOST));
     $form->addElement('text', 'ftp_path', 'FTP Path', array('size' => 50));
     $form->setDefaults(array('ftp_path' => $_SERVER['DOCUMENT_ROOT']));
     $form->addElement('text', 'ftp_username', 'FTP Username');
     $form->addElement('password', 'ftp_password', 'FTP Password');
     $form->addElement('submit', 'submit', 'Submit');
     $form->addRule('database_name', 'Please select a database', 'required', null, 'client');
     $form->addRule('mysql_user', 'Please enter a mysql username that the application can connect as.', 'required', null, 'client');
     $form->addRule('install_type', 'Please select an installation type and then click submit.', 'required', null, 'client');
     $form->setDefaults(array('mysql_user' => $_SERVER['PHP_AUTH_USER'], 'mysql_password' => $_SERVER['PHP_AUTH_PW']));
     if ($form->validate()) {
         $tarpath = $form->process(array(&$this, 'db2app__process'), true);
         header('Content-type: application/x-gzip');
         header('Content-Disposition: attachment; filename="' . basename($tarpath) . '.tar.gz"');
         echo file_get_contents($tarpath);
         exit;
     }
     require_once 'HTML/QuickForm/Renderer/Array.php';
     $renderer = new HTML_QuickForm_Renderer_Array(true, true, true);
     $form->accept($renderer);
     $context = $renderer->toArray();
     //print_r($context);
     ob_start();
     $form->display();
     $out = ob_get_contents();
     ob_end_clean();
     include 'install' . DIRECTORY_SEPARATOR . 'db2app.inc.php';
 }
开发者ID:promoso,项目名称:HVAC,代码行数:52,代码来源:installer.php

示例11: unset

                        $user->user['need_pwd_change'] = 0;
                        $user->persist();
                        unset($_SESSION['s_index_comply']);
                        if ($GLOBALS['configuration']['show_license_note'] && $user->user['viewed_license'] == 0) {
                            eF_redirect("index.php?ctg=agreement");
                        } else {
                            EfrontEvent::triggerEvent(array("type" => EfrontEvent::SYSTEM_VISITED, "users_LOGIN" => $user->user['login'], "users_name" => $user->user['name'], "users_surname" => $user->user['surname']));
                            loginRedirect($user->user['user_type']);
                        }
                    }
                }
            }
            $renderer = new HTML_QuickForm_Renderer_ArraySmarty($smarty);
            $changePasswordForm->setJsWarnings(_BEFOREJAVASCRIPTERROR, _AFTERJAVASCRIPTERROR);
            $changePasswordForm->setRequiredNote(_REQUIREDNOTE);
            $changePasswordForm->accept($renderer);
            $smarty->assign('T_CHANGE_PASSWORD_FORM', $changePasswordForm->toArray());
        } catch (Exception $e) {
            eF_redirect("index.php?message=" . urlencode($e->getMessage() . " (" . $e->getCode() . ")") . "&message_type=failure");
        }
    }
}
/* ---------------------------------------------------------Activation by email part--------------------------------------------------------- */
if (isset($_GET['account']) && isset($_GET['key']) && eF_checkParameter($_GET['account'], 'login') && eF_checkParameter($_GET['key'], 'timestamp')) {
    if ($configuration['activation'] == 0 && $configuration['mail_activation'] == 1 || $configuration['supervisor_mail_activation'] == 1) {
        $result = eF_getTableData("users", "timestamp, active", "login='" . $_GET['account'] . "'");
        if ($result[0]['active'] == 0 && $result[0]['timestamp'] == $_GET['key']) {
            try {
                $user = EfrontUserFactory::factory($_GET['account']);
                //new EfrontUser($_GET['login']);
                $user->activate();
开发者ID:kaseya-university,项目名称:efront,代码行数:31,代码来源:index.php

示例12: getModule

 public function getModule()
 {
     $currentLesson = $this->getCurrentLesson();
     $smarty = $this->getSmartyVar();
     $smarty->assign("T_LESSON_ID", $currentLesson->lesson['id']);
     if (isset($_GET['delete_link']) && eF_checkParameter($_GET['delete_link'], 'id')) {
         eF_deleteTableData("module_links", "id=" . $_GET['delete_link']);
         $this->setMessageVar(_LINKS_SUCCESFULLYDELETEDLINK, 'success');
         eF_redirect("" . $this->moduleBaseUrl . "&message=" . urlencode($message) . "&message_type={$message_type}");
     } else {
         if (isset($_GET['add_link']) || isset($_GET['edit_link']) && eF_checkParameter($_GET['edit_link'], 'id')) {
             $form = new HTML_QuickForm("link_entry_form", "POST", $_SERVER['REQUEST_URI'], "");
             $form->registerRule('checkParameter', 'callback', 'eF_checkParameter');
             //Register this rule for checking user input with our function, eF_checkParameter
             $form->addElement('text', 'display', null);
             $form->addElement('text', 'link', null);
             $form->addElement('textarea', 'description', null);
             $form->addElement('submit', 'submit_link', _SUBMIT, 'class = "flatButton"');
             $element =& $form->getElement('display');
             $element->setSize(50);
             $element =& $form->getElement('link');
             $element->setSize(50);
             $element =& $form->getElement('description');
             $element->setCols(50);
             if (isset($_GET['edit_link'])) {
                 $link_entry = eF_getTableData("module_links", "*", "id=" . $_GET['edit_link']);
                 $form->setDefaults(array('display' => $link_entry[0]['display'], 'link' => $link_entry[0]['link'], 'description' => $link_entry[0]['description']));
             } else {
                 $form->setDefaults(array('link' => "http://"));
             }
             if ($form->isSubmitted() && $form->validate()) {
                 $fields = array('lessons_ID' => $_SESSION['s_lessons_ID'], 'display' => $form->exportValue('display'), 'link' => $form->exportValue('link'), 'description' => $form->exportValue('description'));
                 if (isset($_GET['edit_link'])) {
                     if (eF_updateTableData("module_links", $fields, "id=" . $_GET['edit_link'])) {
                         $message = _LINKS_SUCCESFULLYUPDATEDLINKENTRY;
                         $message_type = 'success';
                         eF_redirect("" . $_SERVER['PHP_SELF'] . "?ctg=module&op=module_links&message=" . urlencode($message) . "&message_type={$message_type}");
                     } else {
                         $message = _LINKS_PROBLEMUPDATINGLINKENTRY;
                         $message_type = 'failure';
                         eF_redirect("" . $_SERVER['PHP_SELF'] . "?ctg=module&op=module_links&message=" . urlencode($message) . "&message_type={$message_type}");
                     }
                 } else {
                     if (eF_insertTableData("module_links", $fields)) {
                         $message = _LINKS_SUCCESFULLYINSERTEDLINKENTRY;
                         $message_type = 'success';
                         eF_redirect("" . $_SERVER['PHP_SELF'] . "?ctg=module&op=module_links&message=" . urlencode($message) . "&message_type={$message_type}");
                     } else {
                         $message = _LINKS_PROBLEMINSERTINGLINKENTRY;
                         $message_type = 'failure';
                         eF_redirect("" . $_SERVER['PHP_SELF'] . "?ctg=module&op=module_links&message=" . urlencode($message) . "&message_type={$message_type}");
                     }
                 }
             }
             $renderer = new HTML_QuickForm_Renderer_ArraySmarty($smarty);
             $form->accept($renderer);
             $smarty->assign('T_LINKS_FORM', $renderer->toArray());
         } else {
             $links = eF_getTableDataFlat("module_links", "*", "lessons_ID = " . $_SESSION['s_lessons_ID']);
             $smarty->assign("T_LINKS", $links);
         }
     }
     return true;
 }
开发者ID:bqq1986,项目名称:efront,代码行数:64,代码来源:module_links.class.php

示例13: basename

}
$backup_form = new HTML_QuickForm("backup_form", "post", basename($_SERVER['PHP_SELF']) . '?ctg=backup', "", null, true);
$backup_form->registerRule('checkParameter', 'callback', 'eF_checkParameter');
//Register this rule for checking user input with our function, eF_checkParameter
$backup_form->addElement('text', 'backupname', null, 'class = "inputText"');
$backup_form->addRule('backupname', _THEFIELD . ' ' . _FILENAME . ' ' . _ISMANDATORY, 'required', null, 'client');
$backup_form->setDefaults(array("backupname" => "backup_" . date('Y_m_d_h.i.s', time())));
if ($GLOBALS['configuration']['version_hosted']) {
    $backupTypes = array("0" => _DATABASEONLY);
} else {
    $backupTypes = array("0" => _DATABASEONLY, "1" => _ALLDATABACKUP);
    if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
        $backupTypes[3] = _ALLDATASYSTEMBACKUP;
    }
}
$backup_form->addElement('select', 'backuptype', null, $backupTypes);
$backup_form->addElement('submit', 'submit_backup', _TAKEBACKUP, 'class = "flatButton" onclick = "$(\'backup_image\').show();"');
if ($backup_form->isSubmitted() && $backup_form->validate()) {
    $values = $backup_form->exportValues();
    try {
        $backupFile = EfrontSystem::backup($values['backupname'] . '.zip', $values['backuptype']);
        eF_redirect("" . basename($_SERVER['PHP_SELF']) . "?ctg=backup&message=" . urlencode(_SUCCESFULLYBACKEDUP) . "&message_type=success");
    } catch (EfrontFileException $e) {
        $smarty->assign("T_EXCEPTION_TRACE", $e->getTraceAsString());
        $message = $e->getMessage() . ' &nbsp;<a href = "javascript:void(0)" onclick = "eF_js_showDivPopup(event, \'' . _ERRORDETAILS . '\', 2, \'error_details\')">' . _MOREINFO . '</a>';
        $message_type = failure;
    }
}
$renderer = new HTML_QuickForm_Renderer_ArraySmarty($smarty);
$backup_form->accept($renderer);
$smarty->assign('T_BACKUP_FORM', $renderer->toArray());
开发者ID:bqq1986,项目名称:efront,代码行数:31,代码来源:backup.php

示例14: 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('&nbsp;', '', $contentOptions[$workbookSettings['unit_to_complete']]);
             $contentOptions[$workbookSettings['unit_to_complete']] = str_replace('&raquo;', '', $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

示例15: getModule

 public function getModule()
 {
     $smarty = $this->getSmartyVar();
     $currentLesson = $this->getCurrentLesson();
     $currentUser = $this->getCurrentUser();
     try {
         $currentContent = new EfrontContentTree($_SESSION['s_lessons_ID']);
         //Initialize content
     } catch (Exception $e) {
         $smarty->assign("T_EXCEPTION_TRACE", $e->getTraceAsString());
         $message = _ERRORLOADINGCONTENT . ": " . $_SESSION['s_lessons_ID'] . ": " . $e->getMessage() . ' (' . $e->getCode() . ') &nbsp;<a href = "javascript:void(0)" onclick = "eF_js_showDivPopup(event, \'' . _ERRORDETAILS . '\', 2, \'error_details\')">' . _MOREINFO . '</a>';
     }
     //pr($currentUser);exit;
     $roles = EfrontUser::getRoles();
     //pr($roles);
     if ($roles[$currentUser->lessons[$_SESSION['s_lessons_ID']]] == "professor") {
         if (isset($_GET['view_list']) && eF_checkParameter($_GET['view_list'], 'id')) {
             $list = $currentContent->seekNode($_GET['view_list']);
             $questions = $list->getQuestions(true);
             $crosslists = array();
             $possibleCrosslistsIds = array();
             foreach ($questions as $key => $value) {
                 if ($value->question['type'] == 'empty_spaces') {
                     $crosslists[] = $value;
                     $possibleCrosslistsIds[] = $value->question['id'];
                 }
             }
             $questions = $crosslists;
             //pr($questions);
             foreach ($questions as $qid => $question) {
                 $questions[$qid]->question['text'] = str_replace('#', '_', strip_tags($question->question['text']));
                 //If we ommit this line, then the questions list is html formatted, images are displayed etc, which is *not* the intended behaviour
                 //$questions[$qid]->question['answer']           = unserialize($question->question['answer']);
             }
             $res = eF_getTableData("module_crossword_words", "crosslists,options", "content_ID=" . $_GET['view_list']);
             $resCrosslists = unserialize($res[0]['crosslists']);
             $smarty->assign("T_CROSSWORD_LIST_WORDS", $resCrosslists);
             $post_target = $this->moduleBaseUrl . '&view_list=' . $_GET['view_list'] . "&tab=options";
             //Create form elements
             $form = new HTML_QuickForm("list_options", "post", $post_target, "", null, true);
             $form->registerRule('checkParameter', 'callback', 'eF_checkParameter');
             $form->addElement('advcheckbox', 'active', _CROSSWORD_ACTIVE, null, 'class = "inputCheckbox"', array(0, 1));
             $form->addElement("text", "max_word", _LOW, 'size = "5"');
             $form->addRule('max_word', _INVALIDFIELDDATA . ":" . _LOW, 'checkParameter', 'id');
             $form->addElement('advcheckbox', 'reveal_answer', _CROSSWORD_SHOWANSWERFIRST, null, 'class = "inputCheckbox"', array(0, 1));
             $form->addElement('advcheckbox', 'save_pdf', _CROSSWORD_SAVEPDF, null, 'class = "inputCheckbox"', array(0, 1));
             $form->addElement('submit', 'submit_options', _SAVECHANGES, 'onclick ="return optionSubmit();" class = "flatButton"');
             //The submit content button
             $options = unserialize($res[0]['options']);
             $form->setDefaults(array('active' => $options['active'], 'reveal_answer' => $options['reveal_answer'], 'save_pdf' => $options['save_pdf'], 'max_word' => $options['max_word']));
             if ($form->isSubmitted() && $form->validate()) {
                 //If the form is submitted and validated
                 $values = $form->exportValues();
                 unset($values['submit_options']);
                 $options = serialize($values);
                 if (sizeof($res) != 0) {
                     $ok = eF_updateTableData("module_crossword_words", array('options' => $options), "content_ID=" . $_GET['view_list']);
                 } else {
                     $fields = array('content_ID' => $_GET['view_list'], 'options' => $options);
                     $ok = eF_insertTableData("module_crossword_words", $fields);
                 }
                 if ($ok !== false) {
                     $message = _CROSSWORD_SUCCESSFULLY;
                     $message_type = 'success';
                 } else {
                     $message = _CROSSWORD_PROBLEMOCCURED;
                     $message_type = 'failure';
                 }
                 eF_redirect("" . $this->moduleBaseUrl . "&view_list=" . $_GET['view_list'] . "&tab=options&message=" . urlencode($message) . "&message_type=" . $message_type);
             }
             $renderer = new HTML_QuickForm_Renderer_ArraySmarty($smarty);
             //Create a smarty renderer
             $form->setJsWarnings(_BEFOREJAVASCRIPTERROR, _AFTERJAVASCRIPTERROR);
             //Set javascript error messages
             $form->setRequiredNote(_REQUIREDNOTE);
             $form->accept($renderer);
             //Assign this form to the renderer, so that corresponding template code is created
             $smarty->assign('T_CROSSWORD_OPTIONS', $renderer->toArray());
             //Assign the form to the template
             if (isset($_GET['postAjaxRequest'])) {
                 try {
                     $result = eF_getTableData("module_crossword_words", "crosslists", "content_ID=" . $_GET['view_list']);
                     //pr($result);exit;
                     $crosslistsArray = unserialize($result[0]['crosslists']);
                     if (isset($_GET['id']) && eF_checkParameter($_GET['id'], 'id')) {
                         if (!in_array($_GET['id'], array_values($crosslistsArray))) {
                             $crosslistsArray[] = $_GET['id'];
                             $crosslists = serialize($crosslistsArray);
                             if (sizeof($result) != 0) {
                                 $fields = array('crosslists' => $crosslists);
                                 eF_updateTableData("module_crossword_words", $fields, "content_ID=" . $_GET['view_list']);
                             } else {
                                 $fields = array('content_ID' => $_GET['view_list'], 'crosslists' => $crosslists);
                                 eF_insertTableData("module_crossword_words", $fields);
                             }
                         } elseif (in_array($_GET['id'], array_values($crosslistsArray))) {
                             unset($crosslistsArray[array_search($_GET['id'], $crosslistsArray)]);
                             if (!empty($crosslistsArray)) {
                                 $crosslists = serialize($crosslistsArray);
                                 $fields = array('crosslists' => $crosslists);
//.........这里部分代码省略.........
开发者ID:bqq1986,项目名称:efront,代码行数:101,代码来源:module_crossword.class.php


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