本文整理汇总了PHP中PHPWS_Core::goBack方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPWS_Core::goBack方法的具体用法?PHP PHPWS_Core::goBack怎么用?PHP PHPWS_Core::goBack使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPWS_Core
的用法示例。
在下文中一共展示了PHPWS_Core::goBack方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: admin
public function admin()
{
switch ($_REQUEST['mop']) {
case 'delete_multimedia':
if (!$this->folder->id || !Current_User::authorized('filecabinet', 'edit_folders', $this->folder->id, 'folder')) {
Current_User::disallow();
}
$this->loadMultimedia(filter_input(INPUT_GET, 'file_id', FILTER_VALIDATE_INT));
$this->multimedia->delete();
PHPWS_Core::goBack();
break;
case 'post_multimedia_upload':
if (!$this->folder->id || !Current_User::authorized('filecabinet', 'edit_folders', $this->folder->id, 'folder')) {
Current_User::disallow();
}
$this->postMultimediaUpload();
\PHPWS_Core::goBack();
break;
case 'upload_multimedia_form':
if (!Current_User::secured('filecabinet', 'edit_folders', $this->multimedia->folder_id, 'folder')) {
Current_User::disallow();
}
$this->loadMultimedia(filter_input(INPUT_GET, 'file_id', FILTER_VALIDATE_INT));
if (!$this->multimedia->id) {
$this->multimedia->folder_id = filter_input(INPUT_GET, 'folder_id', FILTER_VALIDATE_INT);
}
$this->edit();
echo json_encode(array('title' => $this->title, 'content' => $this->content));
exit;
case 'edit_rtmp':
if (!Current_User::secured('filecabinet', 'edit_folders', $this->multimedia->folder_id, 'folder')) {
Current_User::disallow();
}
$this->loadMultimedia(filter_input(INPUT_GET, 'file_id', FILTER_VALIDATE_INT));
$this->editRTMP();
echo json_encode(array('title' => $this->title, 'content' => $this->content));
exit;
case 'post_rtmp':
if (!Current_User::authorized('filecabinet', 'edit_folders', $this->multimedia->folder_id, 'folder')) {
Current_User::disallow();
}
if (!$this->postRTMP()) {
$this->editRTMP();
}
\PHPWS_Core::goBack();
break;
}
return $this->content;
}
示例2: getAllowedStates
public static function getAllowedStates()
{
$db = new \PHPWS_DB('intern_state');
$db->addWhere('active', 1);
$db->addColumn('abbr');
$db->addColumn('full_name');
$db->setIndexBy('abbr');
$db->addOrder('full_name ASC');
$states = $db->select('col');
if (empty($states)) {
\NQ::simple('intern', \Intern\UI\NotifyUI::ERROR, 'The list of allowed US states for internship locations has not been configured. Please use the administrative options to <a href="index.php?module=intern&action=edit_states">add allowed states.</a>');
\NQ::close();
PHPWS_Core::goBack();
}
return $states;
}
示例3: execute
public function execute(CommandContext $context)
{
$request = \Server::getCurrentRequest();
$vars = $request->getVars();
extract($vars['vars']);
if (!isset($schedule_type)) {
throw new \Exception('Unknown schedule type requested');
}
if ($cmd == 'add') {
switch ($schedule_type) {
case 'autoassign':
$this->addAutoAssignSchedule();
break;
case 'reportrunner':
$this->addReportRunnerSchedule();
break;
case 'withdrawn':
$this->addWithdrawnSchedule();
break;
case 'nightly_cache':
$this->addNightlyCacheSchedule();
break;
default:
throw new \Exception('Unknown schedule type requested');
}
} elseif ($cmd == 'remove') {
switch ($schedule_type) {
case 'autoassign':
$this->dropAutoAssignSchedule();
break;
case 'reportrunner':
$this->dropReportRunnerSchedule();
break;
case 'withdrawn':
$this->dropWithdrawnSchedule();
break;
case 'nightly_cache':
$this->dropNightlyCacheSchedule();
break;
default:
throw new \Exception('Unknown schedule type requested');
}
} else {
throw new \Exception('Unknown schedule type requested');
}
PHPWS_Core::goBack();
}
示例4: getAllowedStates
public static function getAllowedStates()
{
$db = new PHPWS_DB('intern_state');
$db->addWhere('active', 1);
$db->addColumn('abbr');
$db->addColumn('full_name');
$db->setIndexBy('abbr');
// get backwards because we flip it
$db->addOrder('full_name desc');
$states = $db->select('col');
if (empty($states)) {
NQ::simple('intern', INTERN_ERROR, 'The list of allowed US states for internship locations has not been configured. Please use the administrative options to <a href="index.php?module=intern&action=edit_states">add allowed states.</a>');
NQ::close();
PHPWS_Core::goBack();
}
$states[-1] = 'Select a state';
$states = array_reverse($states, true);
return $states;
}
示例5: returnToBookmark
public static function returnToBookmark($clear_bm = true)
{
if (isset($_SESSION['PHPWS_Bookmark'])) {
$bm = $_SESSION['PHPWS_Bookmark'];
if ($clear_bm) {
$_SESSION['PHPWS_Bookmark'] = null;
unset($_SESSION['PHPWS_Bookmark']);
}
PHPWS_Core::reroute($bm);
} else {
PHPWS_Core::goBack();
}
}
示例6: post
public function post()
{
switch ($_POST['rop']) {
case 'post_roommate':
$this->loadUserRoommate();
if ($this->roommate->post()) {
try {
$this->roommate->save();
$this->setCarryMessage('Roommate saved successfully.');
\PHPWS_Core::reroute($this->roommate->viewLink());
} catch (\Exception $e) {
$this->setCarryMessage($e->getMessage());
\PHPWS_Core::reroute('index.php?module=properties&rop=view');
}
} else {
$this->editRoommate();
$this->display();
}
break;
case 'send_message':
if (!$this->sendMessage()) {
$this->content = 'Sorry, but we couldn\'t save your message.';
return;
}
if (!$this->roommate->id) {
$this->content = 'Sorry, could not find this roommate. <a href="index.php?module=properties&rop=view">Go back to the list?</a>';
} else {
$this->setCarryMessage('Message sent');
\PHPWS_Core::goBack();
}
break;
case 'report_post':
$this->reportPost();
\PHPWS_Core::reroute('index.php?module=properties&rop=read_messages');
break;
}
}
示例7: admin
//.........这里部分代码省略.........
$this->page->loadTemplate();
$this->page->loadSections(true);
$this->killSaved($this->page->id);
$this->forms->editPage();
break;
case 'delete_page':
if (!Current_User::authorized('pagesmith', 'delete_page')) {
Current_User::disallow();
}
$this->loadPage();
$this->page->delete();
PHPWS_Cache::clearCache();
$this->loadForms();
$this->forms->pageList();
break;
case 'edit_page_header':
$this->loadPage();
$this->loadForms();
$this->forms->editPageHeader();
$javascript = true;
break;
case 'delete_section':
$this->deleteSection($_GET['sec_id']);
exit;
break;
case 'post_header':
$this->postHeader();
break;
case 'post_text':
$this->postText();
break;
case 'post_page':
$result = $this->postPage();
switch ($result) {
case -1:
$this->loadForms();
$this->page->loadSections(true);
$this->forms->editPage();
break;
case 0:
$this->message = dgettext('pagesmith', 'Not enough content to create a page.');
$this->loadForms();
$this->page->loadSections(true);
$this->forms->editPage();
break;
case 1:
$this->killSaved($this->page->id);
PHPWS_Cache::clearCache();
PHPWS_Core::reroute($this->page->url());
break;
}
break;
case 'front_page_toggle':
$db = \Database::newDB();
$db->addTable('ps_page')->addValue('front_page', 0);
$db->update();
$this->loadPage();
$this->page->front_page = (bool) $_GET['fp'];
$this->page->save();
PHPWS_Cache::clearCache();
$this->removeFromMenu();
$this->loadForms();
$this->forms->pageList();
break;
case 'shorten_links':
if (!Current_User::authorized('pagesmith', 'settings', null, null, true)) {
Current_User::disallow();
}
$this->shortenLinks();
PHPWS_Core::goBack();
break;
case 'lengthen_links':
if (!Current_User::authorized('pagesmith', 'settings', null, null, true)) {
Current_User::disallow();
}
$this->lengthenLinks();
PHPWS_Core::goBack();
break;
case 'post_settings':
if (!Current_User::authorized('pagesmith', 'settings', null, null, true)) {
Current_User::disallow();
}
$this->postSettings();
$this->message = dgettext('pagesmith', 'Settings saved');
$this->loadForms();
$this->forms->settings();
break;
default:
PHPWS_Core::errorPage('404');
break;
}
if ($javascript) {
$tpl['TITLE'] = $this->title;
$tpl['CONTENT'] = $this->content;
$tpl['MESSAGE'] = $this->message;
Layout::nakedDisplay(PHPWS_Template::process($tpl, 'pagesmith', 'admin_main.tpl'));
} else {
Layout::add(PHPWS_ControlPanel::display($this->panel->display($this->content, $this->title, $this->message)));
}
}
示例8: action
/**
* Action
*
* @author Greg Meiste <greg.meiste+github@gmail.com>
*/
function action()
{
Layout::addStyle('wiki');
if (!PHPWS_Settings::get('wiki', 'allow_anon_view') && !Current_User::isLogged()) {
Current_User::requireLogin();
return;
}
if (isset($_REQUEST['page_id']) && is_numeric($_REQUEST['page_id'])) {
PHPWS_Core::initModClass('wiki', 'WikiPage.php');
$wikipage = new WikiPage($_REQUEST['page_id']);
} else {
if (isset($_REQUEST['page']) && is_string($_REQUEST['page'])) {
PHPWS_Core::initModClass('wiki', 'WikiPage.php');
$wikipage = new WikiPage($_REQUEST['page']);
}
}
if (!isset($_REQUEST['op']) && !isset($_REQUEST['page_op'])) {
// phpWebSite 1.5.0 and later mod_rewrite method
if (isset($_GET['var1'])) {
$_REQUEST['id'] = $_GET['id'] = $_GET['var1'];
}
if (isset($_REQUEST['id']) && is_string($_REQUEST['id'])) {
PHPWS_Core::initModClass('wiki', 'WikiPage.php');
$wikipage = new WikiPage($_REQUEST['id']);
}
$_REQUEST['page_op'] = 'view';
}
WikiManager::addToMiniAdmin();
if (isset($_REQUEST['page_op']) && isset($wikipage)) {
$wikipage->action();
return;
}
switch (@$_REQUEST['op']) {
case 'admin':
case 'savesettings':
PHPWS_Core::initModClass('wiki', 'WikiSettings.php');
WikiSettings::admin();
break;
case 'doimagedelete':
case 'doimageupload':
case 'imageupload':
WikiManager::imageUpload();
break;
case 'imagedelete':
PHPWS_Core::initModClass('wiki', 'WikiImage.php');
$delImage = new WikiImage($_REQUEST['id']);
$template['TITLE'] = dgettext('wiki', 'Wiki Images');
$template['CONTENT'] = $delImage->delete();
Layout::add(PHPWS_Template::process($template, 'wiki', 'box.tpl'), 'wiki', 'wiki_mod', TRUE);
break;
case 'imagecopy':
PHPWS_Core::initModClass('wiki', 'WikiImage.php');
$image = new WikiImage($_REQUEST['id']);
Clipboard::copy($image->getFilename(), $image->getTag());
PHPWS_Core::goBack();
break;
case 'recentchanges':
$template['TITLE'] = dgettext('wiki', 'Recent changes');
$template['CONTENT'] = WikiManager::recentChanges();
Layout::add(PHPWS_Template::process($template, 'wiki', 'box.tpl'), 'wiki', 'wiki_mod', TRUE);
break;
case 'random':
WikiManager::random();
break;
case 'interwikisetup':
case 'addinterwiki':
PHPWS_Core::initModClass('wiki', 'InterWiki.php');
$interwiki = new InterWiki();
$interwiki->setup();
break;
case 'editinterwiki':
case 'saveinterwiki':
case 'deleteinterwiki':
case 'dodeleteinterwiki':
PHPWS_Core::initModClass('wiki', 'InterWiki.php');
$interwiki = new InterWiki($_REQUEST['id']);
$interwiki->setup();
break;
case 'copyinterwiki':
PHPWS_Core::initModClass('wiki', 'InterWiki.php');
$interwiki = new InterWiki($_REQUEST['id']);
Clipboard::copy($interwiki->getLabel(), $interwiki->getLabel() . ':PageName');
PHPWS_Core::goBack();
break;
default:
$_REQUEST['page'] = PHPWS_Settings::get('wiki', 'default_page');
WikiManager::action();
}
}
示例9: main
public static function main()
{
if (!Current_User::authorized('blog')) {
Current_User::disallow(dgettext('blog', 'User attempted access to Blog administration.'));
return;
}
$title = $content = NULL;
$message = Blog_Admin::getForward();
$panel = Blog_Admin::cpanel();
$panel->enableSecure();
if (isset($_REQUEST['command'])) {
$command = $_REQUEST['command'];
} else {
$command = $panel->getCurrentTab();
}
if (isset($_REQUEST['blog_id'])) {
$blog = new Blog((int) $_REQUEST['blog_id']);
} else {
$blog = new Blog();
}
switch ($command) {
case 'edit':
$panel->setCurrentTab('list');
if (!Current_User::isUser($blog->author_id) && !Current_User::authorized('blog', 'edit_blog', $_REQUEST['blog_id'], 'entry')) {
Current_User::disallow(dgettext('blog', 'User tried to edit a blog.'));
return;
}
$title = dgettext('blog', 'Update Blog Entry');
$content = Blog_Form::edit($blog);
break;
case 'new':
$title = dgettext('blog', 'New Blog Entry');
$content = Blog_Form::edit($blog);
break;
case 'delete':
//Blog_Admin::resetCache();
$result = $blog->delete();
Blog_Admin::setForward(dgettext('blog', 'Blog entry deleted.'), 'list');
break;
case 'list':
$title = dgettext('blog', 'Blog Entries');
$content = Blog_Admin::entry_list();
break;
case 'menu_submit_link':
Menu::pinLink(dgettext('blog', 'Submit entry'), 'index.php?module=blog&action=user&action=submit');
PHPWS_Core::reroute('index.php?module=blog&action=admin&tab=settings&authkey=' . Current_User::getAuthKey());
break;
case 'sticky':
if (!Current_User::isUnrestricted('blog')) {
Current_User::disallow();
}
Blog_Admin::sticky($blog);
PHPWS_Core::goBack();
break;
case 'unsticky':
if (!Current_User::isUnrestricted('blog')) {
Current_User::disallow();
}
Blog_Admin::unsticky($blog);
PHPWS_Core::goBack();
break;
case 'post_entry':
$title = dgettext('blog', 'Blog Archive');
$panel->setCurrentTab('list');
$blog->post_entry();
$link_back = PHPWS_Text::linkAddress('blog', array('action' => 'admin', 'tab' => 'list'), TRUE);
if ($blog->_error) {
if (empty($blog->id)) {
$panel->setCurrentTab('new');
}
$content = Blog_Form::edit($blog);
} else {
if (!isset($_POST['blog_id']) && PHPWS_Core::isPosted()) {
Blog_Admin::setForward(dgettext('blog', 'Entry saved successfully.'), 'list');
}
$result = $blog->save();
//Blog_Admin::resetCache();
if (PHPWS_Error::isError($result)) {
$message = dgettext('blog', 'An error occurred when trying to save your entry. Please check your logs.');
PHPWS_Error::log($result);
Blog_Admin::setForward($message, 'list');
}
if (!$blog->approved) {
Blog_Admin::setForward(dgettext('blog', 'Your entry is being held for approval.'), 'list');
} else {
PHPWS_Core::reroute($blog->getViewLink(true));
}
}
break;
case 'reset_cache':
Blog_Admin::resetCache();
PHPWS_Core::goBack();
break;
case 'post_settings':
if (!Current_User::authorized('blog', 'settings')) {
Current_User::disallow();
return;
}
if (Current_User::isDeity() && isset($_POST['purge_confirm'])) {
$title = dgettext('blog', 'Purge Blog Entries');
//.........这里部分代码省略.........
示例10: main
//.........这里部分代码省略.........
Access::sendMessage(dgettext('access', 'Shortcut deleted'), 'shortcuts');
break;
case 'shortcuts':
PHPWS_Core::initModClass('access', 'Forms.php');
$title = dgettext('access', 'Shortcuts');
$content = Access_Forms::shortcuts();
break;
case 'post_shortcut_list':
$message = NULL;
$result = Access::postShortcutList();
if (PHPWS_Error::isError($result)) {
$message = dgettext('access', 'An error occurred.') . ' ' . dgettext('access', 'Please check your logs.');
}
Access::sendMessage($message, 'shortcuts');
break;
case 'edit_shortcut':
PHPWS_Core::initModClass('access', 'Forms.php');
echo Access_Forms::shortcut_menu();
exit;
break;
case 'post_shortcut':
PHPWS_Core::initModClass('access', 'Shortcut.php');
$sch_id = filter_input(INPUT_POST, 'sch_id', FILTER_SANITIZE_NUMBER_INT);
if ($sch_id) {
$shortcut = new Access_Shortcut($sch_id);
} else {
$shortcut = new Access_Shortcut();
}
try {
$shortcut->postShortcut();
$shortcut->save();
$json['keyword'] = $shortcut->keyword;
$json['error'] = 0;
} catch (\Exception $e) {
$json['message'] = $e->getMessage();
$json['error'] = 1;
}
echo json_encode($json);
exit;
break;
case 'htaccess':
if (Current_User::isDeity()) {
$title = dgettext('access', 'htaccess');
$content = Access::htaccess();
} else {
Current_User::disallow();
}
break;
case 'add_rewritebase':
if (Current_User::isDeity()) {
Access::addRewriteBase();
PHPWS_Core::goBack();
} else {
Current_User::disallow();
}
break;
case 'add_forward':
if (Current_User::isDeity()) {
Access::addForward();
PHPWS_Core::goBack();
} else {
Current_User::disallow();
}
break;
case 'remove_forward':
if (Current_User::isDeity()) {
Access::removeForward();
PHPWS_Core::goBack();
} else {
Current_User::disallow();
}
break;
case 'menu_fix':
Access::menuFix();
PHPWS_Core::goBack();
break;
case 'page_fix':
Access::pageFix();
PHPWS_Core::goBack();
break;
case 'autoforward_on':
PHPWS_Settings::set('access', 'forward_ids', 1);
PHPWS_Settings::save('access');
PHPWS_Core::goBack();
break;
case 'autoforward_off':
PHPWS_Settings::set('access', 'forward_ids', 0);
PHPWS_Settings::save('access');
PHPWS_Core::goBack();
break;
}
}
$tpl['TITLE'] = $title;
$tpl['MESSAGE'] = $message;
$tpl['CONTENT'] = $content;
$main = PHPWS_Template::process($tpl, 'access', 'main.tpl');
$panel->setContent($main);
$finalPanel = $panel->display();
Layout::add(PHPWS_ControlPanel::display($finalPanel));
}
示例11: main
public static function main()
{
if (!Current_User::allow('search')) {
Current_User::disallow();
}
$panel = Search_Admin::cpanel();
if (isset($_REQUEST['command'])) {
$command = $_REQUEST['command'];
} elseif (isset($_REQUEST['tab'])) {
$command = $_REQUEST['tab'];
} else {
$command = $panel->getCurrentTab();
}
switch ($command) {
case 'delete_keyword':
case 'add_keyword':
case 'remove_searchword':
case 'add_ignore':
if (!Current_User::authorized('search')) {
Current_User::disallow();
}
break;
}
switch ($command) {
case 'keyword':
$template = Search_Admin::keyword();
break;
case 'ignore':
$template = Search_Admin::ignore();
break;
case 'settings':
$template = Search_Admin::settings();
break;
case 'close_admin':
unset($_SESSION['Search_Add_Words']);
unset($_SESSION['Search_Admin']);
PHPWS_Core::goBack();
break;
case 'delete_keyword':
Search_Admin::deleteKeyword();
PHPWS_Core::goBack();
break;
case 'add_parse_word':
if (!isset($_REQUEST['keyword'])) {
PHPWS_Core::goBack();
}
Search_Admin::addParseWord($_REQUEST['keyword']);
Search_Admin::sendMessage(dgettext('search', 'Keywords added to admin menu.'), 'keyword');
break;
case 'drop_keyword':
if (isset($_SESSION['Search_Add_Words'])) {
$array_key = array_search($_REQUEST['kw'], $_SESSION['Search_Add_Words']);
if ($array_key !== FALSE) {
unset($_SESSION['Search_Add_Words'][$array_key]);
}
}
PHPWS_Core::goBack();
break;
case 'add_keyword':
if (!isset($_GET['kw']) || !isset($_GET['key_id'])) {
PHPWS_Core::goBack();
}
Search_Admin::addKeyword($_GET['kw'], $_GET['key_id']);
PHPWS_Core::goBack();
break;
case 'remove_searchword':
if (!isset($_GET['kw']) || !isset($_GET['key_id'])) {
PHPWS_Core::goBack();
}
Search_Admin::removeSearchword($_GET['kw'], $_GET['key_id']);
PHPWS_Core::goBack();
break;
case 'add_ignore':
if (!isset($_GET['keyword'])) {
PHPWS_Core::goBack();
}
Search_Admin::setIgnore($_GET['keyword'], 1);
PHPWS_Core::goBack();
break;
case 'remove_ignore':
if (!isset($_GET['keyword'])) {
PHPWS_Core::goBack();
}
Search_Admin::setIgnore($_GET['keyword'], 0);
PHPWS_Core::goBack();
break;
case 'save_settings':
Search_Admin::saveSettings();
Search_Admin::sendMessage(dgettext('search', 'Settings saved'), 'settings');
break;
}
$template['MESSAGE'] = Search_Admin::getMessage();
$final = PHPWS_Template::process($template, 'search', 'main.tpl');
$panel->setContent($final);
$finalPanel = $panel->display();
Layout::add(PHPWS_ControlPanel::display($finalPanel));
}
示例12: display
//.........这里部分代码省略.........
// sizeof($depts) == 2 because of the 'Select Deparmtnet' option
if (sizeof($depts) == 2) {
$keys = array_keys($depts);
$form->setMatch('dept', $keys[1]);
}
// Student level radio button
javascript('jquery');
javascriptMod('intern', 'majorSelector', array('form_id' => $form->id));
$levels = array('-1' => 'Any Level', 'ugrad' => 'Undergraduate', 'grad' => 'Graduate');
$form->addSelect('student_level', $levels);
$form->setLabel('student_level', 'Level');
$form->setClass('student_level', 'form-control');
// Student Major dummy box (gets replaced by dropdowns below using JS when student_level is selected)
$levels = array('-1' => 'Choose student level first');
$form->addDropBox('student_major', $levels);
$form->setLabel('student_major', 'Major / Program');
$form->addCssClass('student_major', 'form-control');
// Undergrad major drop down
if (isset($s)) {
$majors = Major::getMajorsAssoc($s->ugrad_major);
} else {
$majors = Major::getMajorsAssoc();
}
$form->addSelect('ugrad_major', $majors);
$form->setLabel('ugrad_major', 'Undergraduate Majors & Certificate Programs');
$form->setClass('ugrad_major', 'form-control');
// Graduate major drop down
if (isset($s)) {
$progs = GradProgram::getGradProgsAssoc($s->grad_prog);
} else {
$progs = GradProgram::getGradProgsAssoc();
}
$form->addSelect('grad_prog', $progs);
$form->setLabel('grad_prog', 'Graduate Majors & Certificate Programs');
$form->setClass('grad_prog', 'form-control');
// Campus
$campuses = array('main_campus' => 'Main Campus', 'distance_ed' => 'Distance Ed');
$form->addRadioAssoc('campus', $campuses);
/***************
* Course Info *
***************/
$subjects = Subject::getSubjects();
$form->addSelect('course_subj', $subjects);
$form->setLabel('course_subj', 'Subject');
$form->setClass('course_subj', 'form-control');
$form->addText('course_no');
$form->setLabel('course_no', 'Course Number');
$form->setSize('course_no', 6);
$form->setMaxSize('course_no', 4);
$form->setClass('course_no', 'form-control');
$form->addText('course_sect');
$form->setLabel('course_sect', 'Section');
$form->setSize('course_sect', 6);
$form->setMaxSize('course_sect', 4);
$form->setClass('course_sect', 'form-control');
// Internship types.
$types = Internship::getTypesAssoc();
$form->addRadioAssoc('type', $types);
// Location
$loc = array('domestic' => 'Domestic', 'internat' => 'International');
$form->addRadioAssoc('loc', $loc);
/* State search */
$db = new PHPWS_DB('intern_state');
$db->addWhere('active', 1);
$db->addColumn('abbr');
$db->addColumn('full_name');
$db->setIndexBy('abbr');
// get backwards because we flip it
$db->addOrder('full_name desc');
$states = $db->select('col');
if (empty($states)) {
NQ::simple('intern', INTERN_ERROR, 'The list of allowed US states for internship locations has not been configured. Please use the administrative options to <a href="index.php?module=intern&action=edit_states">add allowed states.</a>');
NQ::close();
PHPWS_Core::goBack();
}
$states[-1] = 'Select state';
$states = array_reverse($states, true);
$form->addSelect('state', $states);
$form->setLabel('state', 'State');
$form->setClass('state', 'form-control');
/* Province search */
$form->addText('prov');
$form->setLabel('prov', 'Province/Territory');
$form->setClass('prov', 'form-control');
// Workflow states
$workflowStates = WorkflowStateFactory::getStatesAssoc();
unset($workflowStates['CreationState']);
// Remove this state, since it's not valid (internal only state for initial creation)
$form->addCheckAssoc('workflow_state', $workflowStates);
unset($_REQUEST['module']);
unset($_REQUEST['action']);
unset($_REQUEST['submit']);
//test($_REQUEST,1);
$form->plugIn($_REQUEST);
$form->addSubmit('submit', 'Search');
// Javascript...
javascript('jquery');
javascriptMod('intern', 'resetSearch');
return PHPWS_Template::process($form->getTemplate(), 'intern', 'search.tpl');
}
示例13: permission
public static function permission()
{
if (!isset($_REQUEST['key_id'])) {
return;
}
$key = new Key((int) $_REQUEST['key_id']);
if (!Key::checkKey($key, false)) {
return;
}
if (Current_User::isRestricted($key->module) || !$key->allowEdit()) {
Current_User::disallow();
}
// View permissions must be first to allow error checking
// Edit will add its list to the view
Users_Permission::postViewPermissions($key);
Users_Permission::postEditPermissions($key);
$result = $key->savePermissions();
if (isset($_POST['popbox'])) {
Layout::nakedDisplay(javascript('close_refresh', array('refresh' => 0)));
} else {
if (PHPWS_Error::logIfError($result)) {
$_SESSION['Permission_Message'] = dgettext('users', 'An error occurred.');
} else {
$_SESSION['Permission_Message'] = dgettext('users', 'Permissions updated.');
}
PHPWS_Core::goBack();
}
}
示例14: process
public function process()
{
if (!Current_User::allow('checkin')) {
Current_User::disallow();
}
if (isset($_REQUEST['aop'])) {
if ($_REQUEST['aop'] == 'switch') {
if (Current_User::allow('checkin', 'settings')) {
$cmd = 'settings';
} elseif (Current_User::allow('checkin', 'assign_visitors')) {
$cmd = 'assign';
} else {
$cmd = 'waiting';
}
} else {
$cmd = $_REQUEST['aop'];
}
} elseif ($_REQUEST['tab']) {
$cmd = $_REQUEST['tab'];
} else {
PHPWS_Core::errorPage('404');
}
$js = false;
$js = isset($_GET['print']);
switch ($cmd) {
case 'finish_meeting':
$this->finishMeeting();
PHPWS_Core::goBack();
break;
case 'start_meeting':
$this->startMeeting();
PHPWS_Core::goBack();
break;
case 'sendback':
$this->sendBack();
PHPWS_Core::goBack();
break;
case 'unavailable':
$this->unavailable();
PHPWS_Core::goBack();
break;
case 'available':
$this->available();
PHPWS_Core::goBack();
break;
case 'report':
if (!PHPWS_Settings::get('checkin', 'staff_see_reports') && !Current_User::allow('checkin', 'assign_visitors')) {
Current_User::disallow();
}
if (isset($_GET['daily_report'])) {
$this->dailyReport(isset($_GET['print']));
} elseif (isset($_GET['summary_report'])) {
$this->summaryReport();
} else {
$this->report();
}
//$this->report2();
break;
case 'daily_report':
if (!PHPWS_Settings::get('checkin', 'staff_see_reports') && !Current_User::allow('checkin', 'assign_visitors')) {
Current_User::disallow();
}
break;
case 'month_report':
if (!Current_User::allow('checkin', 'assign_visitors')) {
Current_User::disallow();
}
$this->monthReport(isset($_GET['print']));
break;
case 'visitor_report':
if (!Current_User::allow('checkin', 'assign_visitors')) {
Current_User::disallow();
}
$this->visitorReport(isset($_GET['print']));
break;
case 'reassign':
// Called via ajax
if (Current_User::authorized('checkin', 'assign_visitors')) {
if (isset($_GET['staff_id']) && $_GET['staff_id'] >= 0 && isset($_GET['visitor_id'])) {
$this->loadVisitor($_GET['visitor_id']);
$staff_id = $this->visitor->assigned;
$db = new PHPWS_DB('checkin_visitor');
$db->addValue('assigned', (int) $_GET['staff_id']);
$db->addWhere('id', (int) $_GET['visitor_id']);
PHPWS_Error::logIfError($db->update());
printf('staff_id %s, visitor_id %s', $_GET['staff_id'], $_GET['visitor_id']);
$this->loadStaff($staff_id);
/*
if ($this->staff->status == 3) {
$this->staff->status = 0;
$this->staff->save();
}
*/
}
}
exit;
break;
case 'move_up':
if (Current_User::allow('checkin', 'assign_visitors')) {
$db = new PHPWS_DB('checkin_staff');
//.........这里部分代码省略.........
示例15: get
public function get()
{
$this->loadContact();
switch ($_GET['cop']) {
case 'logout':
unset($_SESSION['Contact_User']);
\PHPWS_Core::home();
break;
case 'manager_sign_up':
if (!self::allowNewUserSignup()) {
$this->title = 'Sorry';
$this->content = '<p>New manager sign ups are not permitted at this time.</p>';
} else {
$this->newManagerSetup();
}
break;
case 'edit_property':
$this->checkPermission();
$this->loadProperty($this->contact->id);
$this->editProperty($this->contact->id);
break;
case 'view_properties':
$this->checkPermission();
$this->title = "Properties list";
$this->propertiesList($this->contact->id);
break;
case 'photo_form':
$photo = new Photo();
echo $photo->form();
exit;
break;
case 'activate_property':
$this->checkPermission();
$this->loadProperty();
$this->property->setActive(true);
$this->property->save();
\PHPWS_Core::goBack();
break;
case 'deactivate_property':
$this->checkPermission();
$this->loadProperty();
$this->property->setActive(false);
$this->property->save();
\PHPWS_Core::goBack();
break;
case 'edit_contact':
$this->checkPermission();
$this->editContact();
break;
case 'delete_photo':
// called via ajax
$this->checkPermission();
ob_start();
$photo = new Photo($_GET['id']);
$photo->delete();
echo Photo::getThumbs($photo->pid);
exit;
break;
case 'delete_property':
$this->checkPermission();
$this->loadProperty();
// double security
if ($this->property->contact_id == $this->contact->id) {
$this->property->delete();
}
\PHPWS_Core::goBack();
break;
case 'make_main':
$photo = new Photo($_GET['id']);
$photo->makeMain();
exit;
break;
case 'update':
$this->checkPermission();
$this->loadProperty();
$this->property->update();
\PHPWS_Core::goBack();
break;
case 'checkUsername':
$this->checkUsername();
exit;
case 'checkEmail':
$this->checkEmail();
exit;
}
$this->display();
}