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


PHP HTML_QuickForm::isSubmitted方法代码示例

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


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

示例1: getModule

 /**
  * The main functionality
  *
  * (non-PHPdoc)
  * @see libraries/EfrontModule#getModule()
  */
 public function getModule()
 {
     $smarty = $this->getSmartyVar();
     $smarty->assign("T_MODULE_BASEDIR", $this->moduleBaseDir);
     $smarty->assign("T_MODULE_BASELINK", $this->moduleBaseLink);
     $smarty->assign("T_MODULE_BASEURL", $this->moduleBaseUrl);
     $currentUser = $this->getCurrentUser();
     if ($currentUser->user['user_type'] != 'administrator') {
         $currentEmployee = $this->getCurrentUser()->aspects['hcd'];
         if (!$currentEmployee || !$currentEmployee->isSupervisor()) {
             throw new Exception("You cannot access this module");
         }
     }
     $form = new HTML_QuickForm("user_activity_form", "post", basename($_SERVER['PHP_SELF']) . "?ctg=module&op=module_idle_users&tab=user_activity", "", null, true);
     $form->addElement('date', 'idle_from_timestamp', _MODULE_IDLE_USERS_SHOWINACTIVEUSERSSINCE, array('minYear' => 2005, 'maxYear' => date("Y")));
     $form->addElement("static", "", '<a href = "javascript:void(0)" onclick = "setFormDate(' . date("Y") . ',' . date("m") . ',' . (date("d") - 7) . ')">' . _LASTWEEK . '</a> - <a href = "javascript:void(0)" onclick = "setFormDate(' . date("Y") . ',' . (date("m") - 1) . ',' . date("d") . ')">' . _LASTMONTH . '</a> - <a href = "javascript:void(0)" onclick = "setFormDate(' . date("Y") . ',' . (date("m") - 3) . ',' . date("d") . ')">' . _MODULE_IDLE_USERS_LAST3MONTHS . '</a>');
     $form->addElement("submit", "submit", _SUBMIT, 'class = "flatButton"');
     if (!isset($_SESSION['timestamp_from'])) {
         $_SESSION['timestamp_from'] = time() - 86400 * 30;
     }
     $form->setDefaults(array("idle_from_timestamp" => $_SESSION['timestamp_from']));
     if ($form->isSubmitted() && $form->validate()) {
         $values = $form->exportValues();
         $_SESSION['timestamp_from'] = mktime(0, 0, 0, $values['idle_from_timestamp']['M'], $values['idle_from_timestamp']['d'], $values['idle_from_timestamp']['Y']);
     }
     $smarty->assign("T_IDLE_USER_FORM", $form->toArray());
     try {
         if ($currentEmployee) {
             if ($_SESSION['s_current_branch'] && in_array($_SESSION['s_current_branch'], $currentEmployee->supervisesBranches)) {
                 $currentBranch = new EfrontBranch($_SESSION['s_current_branch']);
                 $subbranches = $currentBranch->getSubbranches();
                 foreach ($subbranches as $subbranch) {
                     $branches[$subbranch['branch_ID']] = $subbranch['branch_ID'];
                 }
                 $branches[$_SESSION['s_current_branch']] = $_SESSION['s_current_branch'];
                 $result = eF_getTableData("users u JOIN module_hcd_employee_works_at_branch ewb on ewb.users_login=u.login", "u.login,u.name,u.surname,u.active,u.last_login as last_action", "ewb.branch_ID in (" . implode(',', $branches) . ") and u.last_login is null or u.last_login <= " . $_SESSION['timestamp_from']);
                 //$result = eF_getTableData("(select login,name,surname,active,max(l.timestamp) as last_action from users u left outer join logs l on u.login=l.users_LOGIN where u.archive=0 group by login) r join module_hcd_employee_works_at_branch ewb on ewb.users_login=r.login", "*", "ewb.branch_ID in (".implode(',', $branches) .") and (r.last_action is null or r.last_action <= ".$_SESSION['timestamp_from'].")");
             } else {
                 $result = eF_getTableData("users u JOIN module_hcd_employee_works_at_branch ewb on ewb.users_login=u.login", "u.login,u.name,u.surname,u.active,u.last_login as last_action", "ewb.branch_ID in (" . implode(',', $currentEmployee->supervisesBranches) . ") and u.last_login is null or u.last_login <= " . $_SESSION['timestamp_from']);
                 //$result = eF_getTableData("(select login,name,surname,active,max(l.timestamp) as last_action from users u left outer join logs l on u.login=l.users_LOGIN where u.archive=0 group by login) r join module_hcd_employee_works_at_branch ewb on ewb.users_login=r.login", "*", "ewb.branch_ID in (".implode(',', $currentEmployee->supervisesBranches).") and (r.last_action is null or r.last_action <= ".$_SESSION['timestamp_from'].")");
             }
         } else {
             $result = eF_getTableData("users", "login,name,surname,active,last_login as last_action", "last_login is null or last_login <= " . $_SESSION['timestamp_from']);
         }
         $users = array();
         foreach ($result as $value) {
             if ($value['last_action']) {
                 $value['last_action_since'] = eF_convertIntervalToTime(time() - $value['last_action'], true);
             } else {
                 $value['last_action_since'] = null;
             }
             $users[$value['login']] = $value;
         }
         foreach ($users as $key => $value) {
             if (isset($_COOKIE['toggle_active'])) {
                 if ($_COOKIE['toggle_active'] == 1 && !$value['active'] || $_COOKIE['toggle_active'] == -1 && $value['active']) {
                     unset($users[$key]);
                 }
             }
         }
         if (isset($_GET['excel'])) {
             $export_users[] = array(_USER, _MODULE_IDLE_USERS_LASTACTION, _STATUS);
             foreach ($users as $key => $value) {
                 $value['last_action'] ? $last_action = formatTimestamp($value['last_action']) : ($last_action = _NEVER);
                 $value['active'] ? $status = _ACTIVE : ($status = _INACTIVE);
                 $export_users[] = array(formatLogin($value['login']), $last_action, $status);
             }
             EfrontSystem::exportToCsv($export_users, true);
             exit;
         }
         if ($_GET['ajax'] == 'idleUsersTable') {
             list($tableSize, $users) = filterSortPage($users);
             $smarty->assign("T_SORTED_TABLE", $_GET['ajax']);
             $smarty->assign("T_TABLE_SIZE", $tableSize);
             $smarty->assign("T_DATA_SOURCE", $users);
         }
         if (isset($_GET['ajax']) && isset($_GET['archive_user'])) {
             if (isset($users[$_GET['archive_user']])) {
                 $user = EfrontUserFactory::factory($_GET['archive_user']);
                 $user->archive();
             }
             exit;
         } else {
             if (isset($_GET['ajax']) && isset($_GET['archive_all_users'])) {
                 //eF_updateTableData("users", array("archive" => 1, "active" => 0), "login in (select login from (select login,max(l.timestamp) as last_action from users u left outer join logs l on u.login=l.users_LOGIN where u.archive=0 and u.login != '".$_SESSION['s_login']."' group by login) r where r.last_action <= ".$_SESSION['timestamp_from']." or r.last_action is null)");
                 foreach ($users as $value) {
                     eF_updateTableData("users", array("archive" => 1, "active" => 0), "login='" . $value['login'] . "'");
                 }
                 exit;
             } else {
                 if (isset($_GET['ajax']) && isset($_GET['toggle_user'])) {
                     if (isset($users[$_GET['toggle_user']])) {
                         $user = EfrontUserFactory::factory($_GET['toggle_user']);
                         if ($user->user['active']) {
//.........这里部分代码省略.........
开发者ID:bqq1986,项目名称:efront,代码行数:101,代码来源:module_idle_users.class.php

示例2: 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

示例3: array

 $form->registerRule('checkParameter', 'callback', 'eF_checkParameter');
 //Register this rule for checking user input with our function, eF_checkParameter
 $form->addElement('text', 'email', _YOUREMAIL, 'class = "inputText"');
 $form->addRule('email', _THEFIELD . ' "' . _EMAIL . '" ' . _ISMANDATORY, 'required');
 $form->addRule('email', _INVALIDFIELDDATA, 'checkParameter', 'email');
 $form->addElement('text', 'message_subject', _MESSAGESUBJECT, 'class = "inputText"');
 //$form -> addRule('message_subject', _INVALIDFIELDDATA, 'checkParameter', 'text');
 $form->addElement('textarea', 'message_body', _TEXT, 'class = "inputText" id = "contact"');
 $form->addElement('submit', 'submit_contact', _SUBMIT, 'class = "flatButton"');
 if ($_GET['limit_reached']) {
     $form->setDefaults(array('message_subject' => _IWANTTOSIGNUPBUTMAXIMUMUSERSLIMITREACHED, 'message_body' => _IWANTTOSIGNUPBUTMAXIMUMUSERSLIMITREACHEDBODY));
 }
 if ($_SESSION['s_login']) {
     $form->setDefaults(array('email' => $currentUser->user['email']));
 }
 if ($form->isSubmitted()) {
     $fields_insert = array('users_LOGIN' => 'visitor', 'timestamp' => time(), 'action' => 'forms', 'comments' => 'contact', 'session_ip' => eF_encodeIP(eF_getRemoteAddress()));
     eF_insertTableData("logs", $fields_insert);
     if ($form->validate()) {
         $to = $form->exportValue("email");
         $subject = $form->exportValue("message_subject");
         $body = $form->exportValue("message_body") . "\r\n\r\n(" . $subject . " [" . _FROM . ": " . $to . "])";
         if (eF_mail($to, $GLOBALS['configuration']['system_email'], $subject . " [" . _FROM . ": " . $to . "]", $body, false, true)) {
             $copied_body = _THANKYOUFORCONTACTINGUSBODY . "<br/><hr/><br/>" . $form->exportValue("message_body");
             eF_mail($GLOBALS['configuration']['system_email'], $to, _THANKYOUFORCONTACTINGUS, $copied_body, false, false);
             $message = _SENDSUCCESS;
             $message_type = 'success';
             eF_redirect(basename($_SERVER['PHP_SELF']) . '?message=' . urlencode($message) . '&message_type=' . $message_type);
         } else {
             $message = _SENDFAILURE;
             $message_type = 'failure';
开发者ID:bqq1986,项目名称:efront,代码行数:31,代码来源:index.php

示例4: 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

示例5: FilesystemTree

$modulesFolder = new FilesystemTree(G_MODULESPATH, true);
foreach (new EfrontDirectoryOnlyFilterIterator($modulesFolder->tree) as $value) {
    if (!in_array($value['name'], $existingModules)) {
        $modulesList[] = array('className' => $value['name'], 'not_installed' => 1, 'errors' => _MODULEFILESPRESENTNOTINSTALLED);
    }
}
$smarty->assign("T_MODULES", $modulesList);
$upload_form = new HTML_QuickForm("upload_file_form", "post", basename($_SERVER['PHP_SELF']) . '?ctg=modules', "", null, true);
$upload_form->registerRule('checkParameter', 'callback', 'eF_checkParameter');
//Register this rule for checking user input with our function, eF_checkParameter
$upload_form->addElement('file', 'file_upload[0]', null, 'class = "inputText"');
$upload_form->addElement('checkbox', 'overwrite', _OVERWRITEIFFOLDEREXISTS);
$upload_form->setMaxFileSize(FileSystemTree::getUploadMaxSize() * 1024);
//getUploadMaxSize returns size in KB
$upload_form->addElement('submit', 'submit_upload_file', _UPLOAD, 'class = "flatButton"');
if ($upload_form->isSubmitted() && $upload_form->validate()) {
    $filesystem = new FileSystemTree(G_MODULESPATH);
    $uploadedFile = $filesystem->uploadFile('file_upload', G_MODULESPATH, 0);
    if (isset($_GET['upgrade'])) {
        $prev_module_version = eF_getTableData("modules", "position", "className = '" . $_GET['upgrade'] . "'");
        $prev_module_folder = $prev_module_version[0]['position'];
        // The name of the temp folder to extract the new version of the module
        $module_folder = $prev_module_folder;
        //basename($filename[0], '.zip') . time();
        $module_position = $prev_module_folder;
        //basename($filename[0], '.zip');
    } else {
        $module_folder = basename($uploadedFile['path'], '.zip');
        $module_position = $module_folder;
    }
    if (is_dir(G_MODULESPATH . $module_folder) && !isset($_GET['upgrade']) && !isset($_POST['overwrite'])) {
开发者ID:bqq1986,项目名称:efront,代码行数:31,代码来源:modules.php

示例6: getModule

 /**
  * The main functionality
  *
  * (non-PHPdoc)
  * @see libraries/EfrontModule#getModule()
  */
 public function getModule()
 {
     $smarty = $this->getSmartyVar();
     $smarty->assign("T_MODULE_BASEDIR", $this->moduleBaseDir);
     $smarty->assign("T_MODULE_BASELINK", $this->moduleBaseLink);
     $smarty->assign("T_MODULE_BASEURL", $this->moduleBaseUrl);
     $dir = $this->moduleBaseDir . 'assets/';
     if (!is_dir($dir)) {
         mkdir($dir, 0755);
     }
     if ($_SESSION['s_type'] == 'administrator') {
         try {
             $form = new HTML_QuickForm("upload_files_form", "post", $this->moduleBaseUrl . '&tab=upload', "", null, true);
             $form->registerRule('checkParameter', 'callback', 'eF_checkParameter');
             //Register this rule for checking user input with our function, eF_checkParameter
             $form->addElement('file', 'file', _UPLOADFILE);
             if (G_VERSIONTYPE == 'enterprise') {
                 $tree = new EfrontBranchesTree();
                 $pathString = $tree->toPathString();
                 //$result = eF_getTableData("module_hcd_branch", "*", "url is not null and url !=''");
                 $handle = '<img id = "busy" src = "images/16x16/clock.png" style = "display:none;" alt = "{$smarty.const._LOADING}" title = "{$smarty.const._LOADING}"/><div id = "autocomplete_leaflet_branches" class = "autocomplete"></div>&nbsp;&nbsp;&nbsp;';
                 $form->addElement('static', 'sidenote', $handle);
                 $form->addElement('text', 'leaflet_branch_autoselect', _BRANCH, 'class = "autoCompleteTextBox" id = "autocomplete"');
                 $form->addElement('hidden', 'leaflet_branch', '', 'id = "leaflet_branch_value"');
             }
             $form->setMaxFileSize(FileSystemTree::getUploadMaxSize() * 1024);
             $form->addElement('submit', 'submit_upload', _UPLOAD, 'class = "flatButton"');
             if ($form->isSubmitted() && $form->validate()) {
                 $values = $form->exportValues();
                 try {
                     if ($values['leaflet_branch'] && eF_checkParameter($values['leaflet_branch'], 'id')) {
                         $branch = new EfrontBranch($values['leaflet_branch']);
                         if (!$branch->branch['url']) {
                             throw new Exception("You must assign a url to the selected branch to upload files for it");
                         }
                         $dir = $this->moduleBaseDir . 'assets/' . $branch->branch['url'];
                         mkdir($dir, 0755);
                     }
                     $filesystem = new FileSystemTree($dir);
                     $file = $filesystem->uploadFile("file", $dir);
                 } catch (Exception $e) {
                     $smarty->assign("T_EXCEPTION_TRACE", $e->getTraceAsString());
                     $message = $e->getMessage() . ' (' . $e->getCode() . ') &nbsp;<a href = "javascript:void(0)" onclick = "eF_js_showDivPopup(event, \'' . _ERRORDETAILS . '\', 2, \'error_details\')">' . _MOREINFO . '</a>';
                     $message_type = failure;
                     $this->setMessageVar($message, $message_type);
                 }
             }
             $smarty->assign('T_UPLOAD_FORM', $form->toArray());
             $url = $this->moduleBaseUrl;
             $basedir = $dir;
             $options = array('zip' => false, 'upload' => false, 'create_folder' => false, 'folders' => true);
             /**The file manager*/
             include "file_manager.php";
         } catch (Exception $e) {
             $smarty->assign("T_EXCEPTION_TRACE", $e->getTraceAsString());
             $message = $e->getMessage() . ' (' . $e->getCode() . ') &nbsp;<a href = "javascript:void(0)" onclick = "eF_js_showDivPopup(event, \'' . _ERRORDETAILS . '\', 2, \'error_details\')">' . _MOREINFO . '</a>';
             $message_type = 'failure';
             $this->setMessageVar($message, $message_type);
         }
     } else {
         if (defined('G_BRANCH_URL') && G_BRANCH_URL) {
             try {
                 $assets_path = $root_path = $this->moduleBaseDir . 'assets/' . G_BRANCH_URL;
             } catch (Exception $e) {
                 //do nothing here if the directory doesn't exist
             }
         } else {
             $assets_path = $root_path = $this->moduleBaseDir . 'assets/';
         }
         $files = array();
         if (!empty($_GET['folder'])) {
             $folder = urldecode($_GET['folder']);
             if (is_dir($assets_path . $folder)) {
                 $folder = new EfrontDirectory($assets_path . $folder);
                 if (strpos(realpath($folder['path']), $root_path) === false) {
                     throw new Exception("Invalid folder");
                 }
                 $parent_folder = dirname($folder['path']);
                 $url = urlencode(str_replace($root_path, '', $folder['path']));
                 $assets_path = $folder['path'];
                 $parent_url = $this->moduleBaseUrl . "&folder=" . urlencode(str_replace($root_path, '', dirname($folder['path']) . '/'));
                 $parent_url or $parent_url = $this->moduleBaseUrl . 'assets/';
                 $files[] = array('text' => '.. (Up one level)', 'image' => $this->moduleBaseLink . 'ico/folders.png', 'href' => $parent_url);
             }
         }
         //pr($url);pr($parent_url);
         //
         $filesystem = new FileSystemTree($assets_path, true);
         foreach ($filesystem->tree as $key => $value) {
             if ($value instanceof EfrontDirectory) {
                 $files[] = array('text' => basename($key), 'image' => $this->moduleBaseLink . 'ico/folders.png', 'href' => $this->moduleBaseUrl . "&folder=" . urlencode(str_replace($root_path, '', $value['path'] . '/')));
             }
         }
         foreach ($filesystem->tree as $key => $value) {
//.........这里部分代码省略.........
开发者ID:jiangjunt,项目名称:efront_open_source,代码行数:101,代码来源:module_info_kiosk.class.php

示例7: getModule


//.........这里部分代码省略.........
             $form->addElement('submit', 'submit_recheck', _MODULE_SECURITY_RECHECKFILES, 'class = "flatButton" ');
             $form->addElement('submit', 'reset_ignore_list', _MODULE_SECURITY_RESETIGNORELIST, 'class = "flatButton" ');
             $form->addElement('submit', 'ignore_changed_all', _MODULE_SECURITY_IGNOREALL, 'class = "flatButton" ');
             break;
         case 'new_files':
             list($changed_files, $new_files) = $this->checksumCheck();
             if (isset($_GET['download']) && in_array($_GET['download'], array_keys($new_files)) && $_GET['download'] != 'libraries/configuration.php') {
                 try {
                     $file = new EfrontFile(G_ROOTPATH . $_GET['download']);
                     $file->sendFile(true);
                     exit;
                 } catch (Exception $e) {
                     $this->setMessageVar(_MODULE_SECURITY_FILECOULDNOTBEDELETED, 'failure');
                 }
             } else {
                 if (isset($_GET['ignore']) && in_array($_GET['ignore'], array_keys($new_files))) {
                     $this->addToIgnoreList($_GET['ignore']);
                 } else {
                     if (isset($_GET['delete']) && in_array($_GET['delete'], array_keys($new_files))) {
                         try {
                             $file = new EfrontFile(G_ROOTPATH . $_GET['delete']);
                             $file->delete();
                         } catch (Exception $e) {
                         }
                         $file = new EfrontFile($this->getLocalListName());
                         $file->delete();
                         list($changed_files, $new_files) = $this->checksumCheck();
                     }
                 }
             }
             $smarty->assign("T_NEW_FILES", $new_files);
             $form->addElement('submit', 'submit_recheck', _MODULE_SECURITY_RECHECKFILES, 'class = "flatButton" ');
             $form->addElement('submit', 'reset_ignore_list', _MODULE_SECURITY_RESETIGNORELIST, 'class = "flatButton" ');
             $form->addElement('submit', 'ignore_new_all', _MODULE_SECURITY_IGNOREALL, 'class = "flatButton" ');
             break;
         default:
             $smarty->assign("T_SECURITY_FEEDS", $this->getRssFeeds());
             try {
                 $smarty->assign("T_LOCAL_ISSUES", $this->checkLocalIssues());
             } catch (Exception $e) {
                 $this->setMessageVar($e->getMessage(), 'failure');
             }
             break;
     }
     if ($form->isSubmitted() && $form->validate()) {
         try {
             $values = $form->exportValues();
             if ($values['submit_recheck']) {
                 $file = new EfrontFile($this->getLocalListName());
                 $file->delete();
                 eF_redirect($this->moduleBaseUrl . '&type=' . $_GET['type'] . '&message=' . urlencode(_OPERATIONCOMPLETEDSUCCESSFULLY) . '&message_type=success');
             } else {
                 if ($values['submit_delete_install']) {
                     file_get_contents(G_SERVERNAME . 'index.php?delete_install=1');
                     eF_redirect($this->moduleBaseUrl . '&type=' . $_GET['type'] . '&message=' . urlencode(_OPERATIONCOMPLETEDSUCCESSFULLY) . '&message_type=success');
                 } else {
                     if ($values['submit_deactivate']) {
                         $result = eF_updateTableData("users", array('active' => 0), "(login = 'student' and password = '04aed36b7da8d1b5d8c892cf91486cdb') or (login = 'professor' and password = 'da18be534843cf9f9edd60c89de6a8e7')");
                         eF_redirect($this->moduleBaseUrl . '&message=' . urlencode(_OPERATIONCOMPLETEDSUCCESSFULLY) . '&message_type=success');
                     } else {
                         if ($values['reset_ignore_list']) {
                             try {
                                 $file = new EfrontFile($this->getIgnoreListName());
                                 $file->delete();
                                 eF_redirect($this->moduleBaseUrl . '&type=' . $_GET['type'] . '&message=' . urlencode(_OPERATIONCOMPLETEDSUCCESSFULLY) . '&message_type=success');
                             } catch (Exception $e) {
                                 $this->setMessageVar(_MODULE_SECURITY_THELISTISEMTPY, 'failure');
                             }
                         } else {
                             if ($values['ignore_new_all']) {
                                 list($changed_files, $new_files) = $this->checksumCheck();
                                 foreach ($new_files as $key => $value) {
                                     $this->addToIgnoreList($key);
                                 }
                                 eF_redirect($this->moduleBaseUrl . '&type=new_files&message=' . urlencode(_OPERATIONCOMPLETEDSUCCESSFULLY) . '&message_type=success');
                             } else {
                                 if ($values['ignore_changed_all']) {
                                     list($changed_files, $new_files) = $this->checksumCheck();
                                     foreach ($changed_files as $key => $value) {
                                         $this->addToIgnoreList($key);
                                     }
                                     eF_redirect($this->moduleBaseUrl . '&type=changed_files&message=' . urlencode(_OPERATIONCOMPLETEDSUCCESSFULLY) . '&message_type=success');
                                 }
                             }
                         }
                     }
                 }
             }
         } catch (Exception $e) {
             $smarty->assign("T_EXCEPTION_TRACE", $e->getTraceAsString());
             $message = $e->getMessage() . ' (' . $e->getCode() . ') &nbsp;<a href = "javascript:void(0)" onclick = "eF_js_showDivPopup(event, \'' . _ERRORDETAILS . '\', 2, \'error_details\')">' . _MOREINFO . '</a>';
             $this->setMessageVar($message, 'failure');
         }
     }
     $renderer = prepareFormRenderer($form);
     $smarty->assign('T_SECURITY_FORM', $renderer->toArray());
     //$feeds = $this->getRssFeeds(true, false);
     //$smarty->assign("T_SECURITY_FEEDS", $feeds);
     return true;
 }
开发者ID:kaseya-university,项目名称:efront,代码行数:101,代码来源:module_security.class.php

示例8: basename

 $load_editor = true;
 if (G_VERSION_NUM != $GLOBALS['configuration']['database_version']) {
     $smarty->assign("T_DIFFERENT_VERSIONS", true);
 }
 $lockdown_form = new HTML_QuickForm("lockdown_form", "post", basename($_SERVER['PHP_SELF']) . "?ctg=maintenance&tab=lock_down", "", null, true);
 //Build the form
 $lockdown_form->registerRule('checkParameter', 'callback', 'eF_checkParameter');
 //Register our custom input check function
 $lockdown_form->addElement('textarea', 'lock_message', _LOCKDOWNMESSAGE, 'class = "inputContentTextarea mceEditor" style = "width:100%;height:20em;"');
 $lockdown_form->addElement('checkbox', 'logout_users', null, null, 'class = "inputCheckBox"');
 $lockdown_form->setDefaults(array("lock_message" => $GLOBALS['configuration']['lock_message'] ? $GLOBALS['configuration']['lock_message'] : _SYSTEMDOWNFORMAINTENANCE, "logout_users" => true));
 $lockdown_form->addElement('submit', 'submit_lockdown', _LOCKDOWN, 'class = "flatButton"');
 $lockdown_form->addElement('submit', 'submit_message', _SAVECHANGES, 'class = "flatButton"');
 $lockdown_form->addElement('submit', 'submit_unlock', _UNLOCK, 'class = "flatButton"');
 //Check here, whether the system is already locked, and present unlock button
 if ($lockdown_form->isSubmitted() && $lockdown_form->validate()) {
     //If the form is submitted and validated
     $values = $lockdown_form->exportValues();
     if ($GLOBALS['configuration']['lock_down'] && isset($values['submit_unlock'])) {
         EfrontSystem::unlockSystem();
     } elseif (isset($values['submit_lockdown'])) {
         EfrontSystem::lockSystem($values['lock_message'], $values['logout_users']);
     } elseif (isset($values['submit_message'])) {
         EfrontConfiguration::setValue('lock_message', $values['lock_message']);
     }
     eF_redirect(basename($_SERVER['PHP_SELF']) . "?ctg=maintenance&tab=lock_down");
 }
 $renderer = new HTML_QuickForm_Renderer_ArraySmarty($smarty);
 //Create a smarty renderer
 $lockdown_form->accept($renderer);
 //Assign this form to the renderer, so that corresponding template code is created
开发者ID:jiangjunt,项目名称:efront_open_source,代码行数:31,代码来源:maintenance.php

示例9: assign

        $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']);
                $values['correct_multiple_one'] = $values['correct_multiple_one'][0];
                //In multiple_one, only one value is valid. Get this out of the array
                $values['answers_explanation'] = $currentQuestion->answers_explanation;
            } else {
                $values = $form->getSubmitValues();
            }
            //Create each multiple choice from the beginning, this way including any choices the user added himself
            foreach ($values['multiple_one'] as $key => $value) {
开发者ID:jiangjunt,项目名称:efront_open_source,代码行数:31,代码来源:add_question.php

示例10: getModule

 public function getModule()
 {
     $smarty = $this->getSmartyVar();
     global $load_editor;
     $load_editor = true;
     $current_user = $this->getCurrentUser();
     $smarty->assign("T_MODULE_CURRENT_USER", $current_user->getType());
     $form = new HTML_QuickForm("module_mail_form", "post", $this->moduleBaseUrl, "", "id = 'module_mail_form'");
     $form->addElement('hidden', 'recipients', $_GET['rec']);
     $form->addElement('text', 'subject', _SUBJECT, 'class = "inputText" style = "width:400px"');
     $form->addElement('textarea', 'body', _BODY, 'class = "simpleEditor" style = "width:100%;height:200px"');
     $form->addElement('checkbox', 'email', _SENDASEMAILALSO, null, 'id = "send_as_email" class = "inputCheckBox"');
     $form->addRule('subject', _THEFIELD . ' "' . _SUBJECT . '" ' . _ISMANDATORY, 'required', null, 'client');
     $form->addRule('recipients', _THEFIELD . ' "' . _RECIPIENTS . '" ' . _ISMANDATORY, 'required', null, 'client');
     $form->addElement('file', 'attachment[0]', _ATTACHMENT, null, 'class = "inputText"');
     $form->addElement('submit', 'submit_mail', _SEND, 'class = "flatButton"');
     if ($form->isSubmitted() && $form->validate()) {
         $values = $form->exportValues();
         switch ($values['recipients']) {
             case "lesson_students":
                 $lesson = new EfrontLesson($_SESSION['s_lessons_ID']);
                 $lessonUsers = $lesson->getUsers("student");
                 foreach ($lessonUsers as $value) {
                     $mail_recipients[] = $value['login'];
                 }
                 //pr($mail_recipients);return;
                 break;
             case "lesson_professors":
                 $lesson = new EfrontLesson($_SESSION['s_lessons_ID']);
                 $lessonUsers = $lesson->getUsers("professor");
                 if (isset($_SESSION['s_courses_ID'])) {
                     $course = new EfrontCourse($_SESSION['s_courses_ID']);
                     $course_users = $course->getCourseUsers();
                     foreach ($lessonUsers as $key => $value) {
                         if (!isset($course_users[$key])) {
                             unset($lessonUsers[$key]);
                         }
                     }
                 }
                 foreach ($lessonUsers as $value) {
                     $mail_recipients[] = $value['login'];
                 }
                 break;
             case "admin":
                 $result = eF_getTableData("users", "*", "user_type='administrator' and user_types_ID=0 and archive = 0");
                 //not
                 foreach ($result as $value) {
                     $mail_recipients[] = $value['login'];
                 }
                 break;
         }
         //$list = implode(",",$mail_recipients);
         $pm = new eF_PersonalMessage($_SESSION['s_login'], $mail_recipients, $values['subject'], $values['body']);
         if ($_FILES['attachment']['name'][0] != "") {
             $maxFileSize = FileSystemTree::getUploadMaxSize();
             if ($_FILES['attachment']['size'][0] == 0 || $_FILES['attachment']['size'][0] > $maxFileSize * 1024) {
                 //	G_MAXFILESIZE is deprecated
                 $message = _EACHFILESIZEMUSTBESMALLERTHAN . " " . G_MAXFILESIZE . " Bytes";
                 $message_type = 'failure';
             }
             //Upload user avatar file
             $pm->sender_attachment_timestamp = time();
             $user_dir = G_UPLOADPATH . $_SESSION['s_login'] . '/message_attachments/Sent/' . $pm->sender_attachment_timestamp . '/';
             mkdir($user_dir, 0755);
             $filesystem = new FileSystemTree($user_dir);
             $uploadedFile = $filesystem->uploadFile('attachment', $user_dir, 0);
             $pm->sender_attachment_fileId = $uploadedFile['id'];
             $pm->setAttachment($uploadedFile['path']);
         }
         if ($pm->send($values['email'], $values)) {
             $message = _MESSAGEWASSENT;
             $message_type = 'success';
         } else {
             $message = $pm->errorMessage;
             $message_type = 'failure';
         }
     }
     $renderer = new HTML_QuickForm_Renderer_ArraySmarty($smarty);
     //Create a smarty renderer
     $renderer->setRequiredTemplate('{$html}{if $required}
     	&nbsp;<span class = "formRequired">*</span>
 		{/if}');
     $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_MODULE_MAIL_FORM', $renderer->toArray());
     $smarty->assign("T_MESSAGE_MAIL", $message);
     $smarty->assign("T_MESSAGE_MAIL_TYPE", $message_type);
     //pr($renderer -> toArray());
     return true;
 }
开发者ID:kaseya-university,项目名称:efront,代码行数:93,代码来源:module_quick_mails.class.php

示例11: array

 $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));
             }
         }
         EfrontConfiguration::setValue('social_modules_activated', $socialModulesToBeActivated);
         eF_redirect(basename($_SERVER['PHP_SELF']) . "?ctg=system_config&op=external&tab=facebook&message=" . urlencode(_SUCCESFULLYUPDATECONFIGURATION) . "&message_type=success");
开发者ID:bqq1986,项目名称:efront,代码行数:31,代码来源:external.php

示例12: getModule

 public function getModule()
 {
     // Get smarty variable
     $smarty = $this->getSmartyVar();
     if (isset($_GET['delete_faq']) && eF_checkParameter($_GET['delete_faq'], 'id')) {
         eF_deleteTableData("module_faq", "id=" . $_GET['delete_faq']);
         eF_redirect("" . $this->moduleBaseUrl . "&message=" . urlencode(_FAQ_SUCCESFULLYDELETEDFAQENTRY) . "&message_type=success");
     } else {
         if (isset($_GET['add_faq']) || isset($_GET['edit_faq']) && eF_checkParameter($_GET['edit_faq'], 'id')) {
             $load_editor = true;
             //TODO
             $form = new HTML_QuickForm("faq_entry_form", "post", $_SERVER['REQUEST_URI'], "", null, true);
             $form->registerRule('checkParameter', 'callback', 'eF_checkParameter');
             //Register this rule for checking user input with our function, eF_checkParameter
             $form->addElement('textarea', 'question', null, 'class = "simpleEditor" style = "width:100%;height:5em;"');
             $form->addElement('textarea', 'answer', null, 'class = "simpleEditor" style = "width:100%;height:25em;"');
             $currentLesson = $this->getCurrentLesson();
             $units = eF_getTableDataFlat("content", "id, name", "lessons_ID = " . $currentLesson->lesson['id']);
             //$units['id'] = array_merge(array("0"), $units['id']);
             //$units['name'] = array_merge(array(_FAQ_GENERAL_LESSON), $units['name']);
             sizeof($units) > 0 ? $units = array(0 => _FAQ_GENERAL_LESSON) + array_combine($units['id'], $units['name']) : ($units = array("0" => _FAQ_GENERAL_LESSON));
             $form->addElement('select', 'related_content', _CONTENT, $units, 'class = "inputSelectLong"');
             $form->addElement('submit', 'submit_faq', _SUBMIT, 'class = "flatButton"');
             if (isset($_GET['edit_faq'])) {
                 $faq_entry = eF_getTableData("module_faq", "*", "id=" . $_GET['edit_faq']);
                 $form->setDefaults(array('related_content' => $faq_entry[0]['unit_ID'], 'question' => $faq_entry[0]['question'], 'answer' => $faq_entry[0]['answer']));
             }
             if ($form->isSubmitted() && $form->validate()) {
                 $fields = array('lessons_ID' => $_SESSION['s_lessons_ID'], 'unit_ID' => $form->exportValue('related_content'), 'question' => $form->exportValue('question'), 'answer' => $form->exportValue('answer'));
                 if (isset($_GET['edit_faq'])) {
                     if (eF_updateTableData("module_faq", $fields, "id=" . $_GET['edit_faq'])) {
                         eF_redirect("" . $this->moduleBaseUrl . "&message=" . urlencode(_FAQ_SUCCESFULLYUPDATEDFAQENTRY) . "&message_type=success");
                     } else {
                         $this->setMessageVar(_FAQ_PROBLEMUPDATINGFAQENTRY, 'failure');
                     }
                 } else {
                     if (eF_insertTableData("module_faq", $fields)) {
                         eF_redirect("" . $this->moduleBaseUrl . "&message=" . urlencode(_FAQ_SUCCESFULLYINSERTEDFAQENTRY) . "&message_type=success");
                     } else {
                         $this->setMessageVar(_FAQ_PROBLEMINSERTINGFAQENTRY, 'failure');
                     }
                 }
             }
             $renderer = new HTML_QuickForm_Renderer_ArraySmarty($smarty);
             $form->accept($renderer);
             $smarty->assign('T_FAQ_FORM', $renderer->toArray());
         } else {
             $currentLesson = $this->getCurrentLesson();
             $faq = eF_getTableDataFlat("module_faq", "*", "lessons_ID=" . $currentLesson->lesson['id']);
             $currentUser = $this->getCurrentUser();
             $smarty->assign("T_FAQUSERLESSONROLE", $currentUser->getRole($currentLesson));
             $smarty->assign("T_FAQ", $faq);
             $smarty->assign("T_QUESTIONS_FOUND", sizeof($faq));
         }
     }
     return true;
 }
开发者ID:bqq1986,项目名称:efront,代码行数:57,代码来源:module_faq.class.php

示例13: 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

示例14: basename

 $_SESSION['s_index_comply'] = 'password_change';
 $user = EfrontUserFactory::factory($_SESSION['s_login']);
 $changePasswordForm = new HTML_QuickForm("change_password_form", "post", basename($_SERVER['PHP_SELF']) . "?ctg=password_change", "", "class = 'indexForm'", true);
 $changePasswordForm->addElement('password', 'old_password', _OLDPASSWORD, 'class = "inputText"');
 // SMS: 7/23/2014 Changed to support vLab
 // $changePasswordForm -> addElement('password', 'password', _NEWPASSWORD, 'class = "inputText"');
 $changePasswordForm->addElement('password', 'password', _NEWPASSWORD, 'class = "inputText"');
 $changePasswordForm->addElement('password', 'passrepeat', _REPEATPASSWORD, 'class = "inputText"');
 $changePasswordForm->addRule('password', _THEFIELD . ' ' . _PASSWORD . ' ' . _ISMANDATORY, 'required', null, 'client');
 $changePasswordForm->addRule('passrepeat', _THEFIELD . ' ' . _REPEATPASSWORD . ' ' . _ISMANDATORY, 'required', null, 'client');
 // SMS: 7/23/2014 Changed to support vLab
 // $changePasswordForm -> addRule(array('password', 'passrepeat'), _PASSWORDSDONOTMATCH, 'compare', null, 'client');
 $changePasswordForm->addRule(array('password', 'passrepeat'), _PASSWORDSDONOTMATCH, 'compare', null, 'client');
 $changePasswordForm->addRule('passrepeat', str_replace("%x", $GLOBALS['configuration']['password_length'], _PASSWORDMUSTBE6CHARACTERS), 'minlength', $GLOBALS['configuration']['password_length'], 'client');
 $changePasswordForm->addElement('submit', 'submit', _SUBMIT, 'class = "flatButton"');
 if ($changePasswordForm->isSubmitted() && $changePasswordForm->validate()) {
     $newPassword = $changePasswordForm->exportValue('password');
     $newPassword = EfrontUser::createPassword($newPassword);
     if ($user->user['password'] != EfrontUser::createPassword($changePasswordForm->exportValue('old_password'))) {
         $message = _OLDPASSWORDWRONG;
         $message_type = 'failure';
     } else {
         if ($user->user['password'] == $newPassword) {
             $message = _PASSWORDISTHESAME;
             $message_type = 'failure';
         } else {
             $user->user['password'] = $newPassword;
             $user->user['need_pwd_change'] = 0;
             $user->persist();
             unset($_SESSION['s_index_comply']);
             if ($GLOBALS['configuration']['show_license_note'] && $user->user['viewed_license'] == 0) {
开发者ID:kaseya-university,项目名称:efront,代码行数:31,代码来源:index.php

示例15: sendMessage

$form->addElement("text", "firstName", "First name");
$form->addElement("text", "lastName", "Last name");
$form->addElement("text", "emailAddress", "Email address");
$form->addElement("text", "subject", "Message subject");
$form->addElement("textarea", "message", "Message", array("rows" => 10, "cols" => 50));
$form->addElement("submit", "sendButton", "Send Message");
$form->addRule("firstName", "Please enter your first name", "required");
$form->addRule("firstName", "The First Name field can contain only letters, digits, spaces, apostrophes, and hyphens", "regex", "/^[ \\'\\-a-zA-Z0-9]+\$/");
$form->addRule("lastName", "Please enter your last name", "required");
$form->addRule("lastName", "The Last Name field can contain only letters, digits, spaces, apostrophes, and hyphens", "regex", "/^[ \\'\\-a-zA-Z0-9]+\$/");
$form->addRule("emailAddress", "Please enter an email address", "required");
$form->addRule("emailAddress", "Please enter a valid email address", "email");
$form->addRule("subject", "Please enter a message subject", "required");
$form->addRule("subject", "Your subject can contain only letters, digits, spaces, apostrophes, commas, periods, and hyphens", "regex", "/^[ \\'\\,\\.\\-a-zA-Z0-9]+\$/");
$form->addRule("message", "Please enter your message", "required");
if ($form->isSubmitted() and $form->validate()) {
    $form->process("sendMessage");
} else {
    echo "<p>Please fill in all the fields below, then click Send Message to send us an email.</p>";
    $renderer = new HTML_QuickForm_Renderer_Tableless();
    $form->accept($renderer);
    echo $renderer->toHtml();
}
function sendMessage($values)
{
    $recipient = OWNER_FIRST_NAME . " " . OWNER_LAST_NAME . " <" . OWNER_EMAIL_ADDRESS . ">";
    $headers = "From: " . $values["firstName"] . " " . $values["lastName"] . " <" . $values["emailAddress"] . ">";
    if (mail($recipient, $values["subject"], $values["message"], $headers)) {
        echo "<p>Thanks for your message! Someone will be in touch shortly.</p>";
    } else {
        echo '<p>Sorry, your message could not be sent.</p>';
开发者ID:raynaldmo,项目名称:php-education,代码行数:31,代码来源:contact.php


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