本文整理汇总了PHP中Layout::nakedDisplay方法的典型用法代码示例。如果您正苦于以下问题:PHP Layout::nakedDisplay方法的具体用法?PHP Layout::nakedDisplay怎么用?PHP Layout::nakedDisplay使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Layout
的用法示例。
在下文中一共展示了Layout::nakedDisplay方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: admin
public function admin()
{
/**
* Folder permissions needed
*/
switch ($_REQUEST['fop']) {
case 'open_file_manager':
if (!Current_User::verifySaltedUrl()) {
javascript('close_refresh');
Layout::nakedDisplay();
}
return $this->openFileManager();
break;
case 'fm_folders':
return $this->folderView();
break;
case 'fm_fld_contents':
return $this->folderContentView();
break;
case 'pick_file':
$this->pickFile();
break;
case 'resize_pick':
$this->resizePick();
break;
}
}
示例2: admin
public function admin()
{
switch ($_REQUEST['iop']) {
case 'delete_image':
if (!$this->folder->id || !Current_User::secured('filecabinet', 'edit_folders', $this->folder->id, 'folder')) {
Current_User::disallow();
}
$this->loadImage(filter_input(INPUT_GET, 'file_id', FILTER_VALIDATE_INT));
$this->image->delete();
PHPWS_Core::goBack();
break;
case 'post_image_upload':
if (!$this->folder->id || !Current_User::authorized('filecabinet', 'edit_folders', $this->folder->id, 'folder')) {
Current_User::disallow();
}
if (!$this->postImageUpload()) {
\Cabinet::setMessage('Failed to upload image. Check directory permissions.');
}
Layout::nakedDisplay();
//\PHPWS_Core::goBack();
break;
case 'upload_image_form':
if (!$this->folder->id || !Current_User::secured('filecabinet', 'edit_folders', $this->folder->id, 'folder')) {
Current_User::disallow();
}
$this->loadImage(filter_input(INPUT_GET, 'file_id', FILTER_VALIDATE_INT));
$this->edit();
echo Layout::wrap($this->content, 'Image Upload', true);
exit;
}
}
示例3: check_cookie
function check_cookie()
{
$cookie = PHPWS_Cookie::read('cookie_enabled');
if (!$cookie) {
if (!isset($_GET['cc'])) {
PHPWS_Cookie::write('cookie_enabled', 'y');
PHPWS_Core::reroute('index.php?cc=1');
} else {
$tpl['MESSAGE'] = dgettext('layout', 'This site requires you to enable cookies on your browser.');
$message = PHPWS_Template::process($tpl, 'layout', 'no_cookie.tpl');
Layout::nakedDisplay($message);
}
}
}
示例4: execute
public function execute(CommandContext $context)
{
if (!Current_User::allow('hms', 'reports')) {
PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
throw new PermissionException('You do no have permission to run reports.');
}
PHPWS_Core::initModClass('hms', 'HMS_Reports.php');
$reportName = $context->get('report');
if (is_null($reportName)) {
throw new InvalidArgumentException('Missing report name.');
}
//$context->setContent(HMS_Reports::runReport($reportName));
Layout::nakedDisplay(HMS_Reports::runReport($reportName), true);
}
示例5: action
/**
*
*
*
*
*/
function action()
{
switch ($_REQUEST['PHAT_REPORT_OP']) {
case 'list':
if (Current_User::allow('phatform', 'report_view')) {
$content = $this->report();
} else {
$this->accessDenied();
}
break;
case 'edit':
if (Current_User::allow('phatform', 'report_edit')) {
$content = $_SESSION['PHAT_FormManager']->menu() . $this->edit();
} else {
$this->accessDenied();
}
break;
case 'view':
if (Current_User::allow('phatform', 'report_view')) {
$content = $_SESSION['PHAT_FormManager']->menu() . $this->view();
} else {
$this->accessDenied();
}
break;
case 'confirmDelete':
if (Current_User::allow('phatform', 'report_delete')) {
$content = $this->confirmDelete();
} else {
$this->accessDenied();
}
break;
case 'delete':
if (Current_User::allow('phatform', 'report_delete')) {
$content = $this->delete();
} else {
$this->accessDenied();
}
break;
case 'export':
if (Current_User::allow('phatform', 'report_export')) {
include PHPWS_SOURCE_DIR . 'mod/phatform/inc/Export.php';
$error = export($this->_formId);
if (PHPWS_Error::isError($error)) {
javascript('alert', array('content' => PHPWS_Error::printError($error)));
$content = $this->report();
}
} else {
$this->accessDenied();
}
break;
}
if ($content) {
if (isset($_REQUEST['lay_quiet'])) {
Layout::nakedDisplay($content);
} else {
$GLOBALS['CNT_phatform']['content'] = $content;
}
}
}
示例6: postDocumentUpload
/**
* @Override FC_Document_Manager::postDocumentUpload().
*
* This is a copy and past of the overriden function except
* that we now create a new InternDocument object
* and save it to databse.
*/
public function postDocumentUpload()
{
// importPost in File_Common
$result = $this->document->importPost('file_name');
if (\PHPWS_Error::isError($result) || !$result) {
\PHPWS_Error::log($result);
$vars['timeout'] = '3';
$vars['refresh'] = 0;
javascript('close_refresh', $vars);
return dgettext('filecabinet', 'An error occurred when trying to save your document.');
} elseif ($result) {
$result = $this->document->save();
if (\PHPWS_Error::logIfError($result)) {
$content = dgettext('filecabinet', '<p>Could not upload file to folder. Please check your directory permissions.</p>');
$content .= sprintf('<a href="#" onclick="window.close(); return false">%s</a>', dgettext('filecabinet', 'Close this window'));
Layout::nakedDisplay($content);
exit;
}
//\PHPWS_Core::initModClass('filecabinet', 'File_Assoc.php');
//\FC_File_Assoc::updateTag(\FC_DOCUMENT, $this->document->id, $this->document->getTag());
$this->document->moveToFolder();
// If the document's id is set in the request
// then we are updating a file. Not need to insert
// it into database.
if (!isset($_REQUEST['document_id'])) {
// Save InternDocument in database.
$doc = new InternDocument();
$doc->internship_id = $_REQUEST['internship'];
$doc->document_fc_id = $this->document->id;
$result = $doc->save();
}
// Choose the proper notification text...
if (isset($_REQUEST['document_id']) && $_REQUEST['document_id'] && $result) {
\NQ::simple('intern', \Intern\UI\NotifyUI::SUCCESS, "File saved.");
} else {
if ($result) {
\NQ::simple('intern', \Intern\UI\NotifyUI::SUCCESS, "File added.");
} else {
if (\PHPWS_Error::logIfError($result)) {
\NQ::simple('intern', \Intern\UI\NotifyUI::ERROR, $result->toString());
}
}
}
\NQ::close();
if (!isset($_POST['im'])) {
javascript('close_refresh');
} else {
javascript('/filecabinet/refresh_manager', array('document_id' => $this->document->id));
}
} else {
return $this->edit();
}
}
示例7: show
public function show()
{
$tpl = new PHPWS_Template('hms');
if (!$tpl->setFile('admin/reports/hall_overview.tpl')) {
return 'Template error.';
}
$rlcs = HMS_Learning_Community::getRlcList();
$rlcs_abbr = HMS_Learning_Community::getRLCListAbbr();
$tpl->setData(array('HALL' => $this->hall->hall_name, 'TERM' => Term::getPrintableSelectedTerm()));
if ($this->nakedDisplay) {
$menuCmd = CommandFactory::getCommand('ShowAdminMaintenanceMenu');
$tpl->setData(array('MAINTENANCE' => $menuCmd->getLink('Main Menu')));
}
$class = 'toggle1';
$this->hall->loadFloors();
foreach ($this->hall->_floors as $floor) {
$floor->loadRooms();
if (!isset($floor->_rooms)) {
continue;
}
if ($floor->rlc_id != NULL) {
$floor_rlc = $rlcs[$floor->rlc_id];
} else {
$floor_rlc = '';
}
foreach ($floor->_rooms as $room) {
$extra_attribs = '';
if ($room->isOffline()) {
$extra_attribs .= 'Offline ';
}
if ($room->isReserved()) {
$extra_attribs .= 'Reserved ';
}
if ($room->isRa()) {
$extra_attribs .= 'RA ';
}
if ($room->isPrivate()) {
$extra_attribs .= 'Private ';
}
if ($room->isOverflow()) {
$extra_attribs .= 'Overflow ';
}
if ($room->isParlor()) {
$extra_attribs .= 'Parlor ';
}
if ($room->isADA()) {
$extra_attribs .= 'ADA';
}
if ($room->isHearingImpaired()) {
$extra_attribs .= 'Hearing Impaired';
}
if ($room->bathEnSuite()) {
$extra_attribs .= 'Bath en Suite';
}
$room->loadBeds();
if (empty($room->_beds)) {
$tpl->setCurrentBlock('room_repeat');
$tpl->setData(array('EXTRA_ATTRIBS' => $extra_attribs, 'ROOM_NUMBER' => $room->getLink('Room')));
$tpl->parseCurrentBlock();
continue;
}
foreach ($room->_beds as $bed) {
$bed->loadAssignment();
$tpl->setCurrentBlock('bed_repeat');
$bed_link = $bed->getLink();
if (isset($bed->_curr_assignment)) {
$username = $bed->_curr_assignment->asu_username;
try {
$student = StudentFactory::getStudentByUsername($username, $this->hall->term);
} catch (StudentNotFoundException $e) {
$student = null;
NQ::simple('hms', hms\NotificationView::WARNING, "Could not find data for: {$username}");
}
$assign_rlc = HMS_RLC_Assignment::checkForAssignment($username, $this->hall->term);
//false or index
if ($assign_rlc != FALSE) {
$rlc_abbr = $rlcs_abbr[$assign_rlc['rlc_id']];
//get the abbr for the rlc
} else {
$rlc_abbr = '';
}
// Alternating background colors
if ($class == 'toggle1') {
$class = 'toggle2';
} else {
$class = 'toggle1';
}
if (is_null($student)) {
$tpl->setData(array('BED_LABEL' => $bed->bedroom_label, 'BED' => $bed_link, 'NAME' => 'UNKNOWN', 'USERNAME' => $username, 'BANNER_ID' => '', 'TOGGLE' => $class, 'RLC_ABBR' => $rlc_abbr));
} else {
$tpl->setData(array('BED_LABEL' => $bed->bedroom_label, 'BED' => $bed_link, 'NAME' => $student->getProfileLink(), 'USERNAME' => $student->getUsername(), 'BANNER_ID' => $student->getBannerId(), 'TOGGLE' => $class, 'RLC_ABBR' => $rlc_abbr));
}
} else {
$tpl->setData(array('BED_LABEL' => $bed->bedroom_label, 'BED' => $bed_link, 'NAME' => $bed->get_assigned_to_link(), 'VACANT' => ''));
}
$tpl->parseCurrentBlock();
}
$tpl->setCurrentBlock('room_repeat');
$tpl->setData(array('EXTRA_ATTRIBS' => $extra_attribs, 'ROOM_NUMBER' => $room->getLink('Room')));
$tpl->parseCurrentBlock();
//.........这里部分代码省略.........
示例8: process
//.........这里部分代码省略.........
case 'edit_staff':
if (Current_User::allow('checkin', 'settings')) {
$this->loadStaff(null, true);
$this->editStaff();
}
break;
case 'search_users':
$this->searchUsers();
break;
case 'update_reason':
if (Current_User::allow('checkin', 'settings')) {
if (Current_User::authorized('checkin', 'settings')) {
$this->updateReason();
}
$this->panel->setCurrentTab('settings');
$this->settings();
}
break;
case 'post_staff':
if (!Current_User::authorized('checkin', 'settings')) {
Current_User::disallow();
}
if ($this->postStaff()) {
// save post
$this->staff->save();
$this->staff->saveReasons();
PHPWS_Core::reroute('index.php?module=checkin&tab=staff');
} else {
// post failed
$this->loadStaff();
$this->editStaff();
}
break;
case 'post_settings':
// from Checkin_Admin::settings
if (Current_User::authorized('checkin', 'settings')) {
$this->postSettings();
}
PHPWS_Core::reroute('index.php?module=checkin&tab=settings');
break;
case 'edit_reason':
$this->loadReason();
$this->editReason();
break;
case 'delete_reason':
$this->loadReason();
$this->reason->delete();
PHPWS_Core::goBack();
break;
case 'deactivate_staff':
PHPWS_Core::initModClass('checkin', 'Staff.php');
$staff = new Checkin_Staff($_GET['id']);
$staff->active = 0;
$staff->save();
PHPWS_Core::goBack();
break;
case 'activate_staff':
PHPWS_Core::initModClass('checkin', 'Staff.php');
$staff = new Checkin_Staff($_GET['id']);
$staff->active = 1;
$staff->save();
PHPWS_Core::goBack();
break;
// This is for testing purposes and never happens in actual use
// This is for testing purposes and never happens in actual use
case 'unassignAll':
$this->unassignAll();
break;
// This is for testing purposes and never happens in actual use
// This is for testing purposes and never happens in actual use
case 'auto_assign':
$this->autoAssign();
break;
}
if (empty($this->content)) {
$this->content = dgettext('checkin', 'Command not recognized.');
}
if ($js) {
$tpl['TITLE'] =& $this->title;
$tpl['CONTENT'] =& $this->content;
$tpl['MESSAGE'] =& $this->message;
$content = PHPWS_Template::process($tpl, 'checkin', 'main.tpl');
Layout::nakedDisplay($content, $this->title);
} else {
if (is_array($this->message)) {
$this->message = implode('<br />', $this->message);
}
if (!$this->use_sidebar) {
Layout::collapse();
}
if ($this->use_panel) {
Layout::add(PHPWS_ControlPanel::display($this->panel->display($this->content, $this->title, $this->message)));
} else {
$tpl['TITLE'] =& $this->title;
$tpl['CONTENT'] =& $this->content;
$tpl['MESSAGE'] =& $this->message;
Layout::add(PHPWS_Template::process($tpl, 'checkin', 'main.tpl'));
}
}
}
示例9: route
public static function route($action)
{
$title = $content = NULL;
$message = Block_Admin::getMessage();
if (isset($_REQUEST['block_id'])) {
$block = new Block_Item($_REQUEST['block_id']);
} else {
$block = new Block_Item();
}
switch ($action) {
case 'new':
$title = dgettext('block', 'New Block');
$content = Block_Admin::edit($block);
break;
case 'delete':
if (!Current_User::authorized('block', 'delete_block', $_REQUEST['block_id'])) {
Current_User::disallow();
}
$block->kill();
Block_Admin::sendMessage(dgettext('block', 'Block deleted.'));
PHPWS_Core::goBack();
break;
case 'edit':
if (!Current_User::authorized('block', 'edit_block', $_REQUEST['block_id'])) {
Current_User::disallow();
}
$title = 'Edit Block';
$content = Block_Admin::edit($block);
break;
case 'pin_all':
if (!Current_User::authorized('block', 'delete_block', $_REQUEST['block_id'])) {
Current_User::disallow();
}
Block_Admin::pinBlockAll($block);
Block_Admin::sendMessage(dgettext('block', 'Block pinned'), 'list');
break;
case 'remove':
if (!Current_User::authorized('block', 'edit_block', $_REQUEST['block_id'])) {
Current_User::disallow();
}
Block_Admin::removeBlock();
PHPWS_Core::goBack();
break;
case 'postBlock':
if (Block_Admin::postBlock($block)) {
$result = $block->save();
Block_Admin::sendMessage(dgettext('block', 'Block saved'), 'list');
} else {
$message = dgettext('block', 'Block must have a title, some content, or a file attachment.');
$title = 'Edit Block';
$content = Block_Admin::edit($block);
}
break;
case 'settings':
$title = dgettext('block', 'Settings');
$content = Block_Admin::settings();
break;
case 'post_settings':
$result = Block_Admin::postSettings();
if (is_array($result)) {
$message = implode('<br />', $result);
$title = dgettext('block', 'Settings');
$content = Block_Admin::settings();
} else {
Block_Admin::sendMessage(dgettext('block', 'Settings saved'), 'settings');
}
break;
case 'postJSBlock':
if (Block_Admin::postBlock($block)) {
$result = $block->save();
if (PHPWS_Error::isError($result)) {
PHPWS_Error::log($result);
} elseif (isset($_REQUEST['key_id'])) {
Block_Admin::lockBlock($block->id, $_REQUEST['key_id']);
}
PHPWS_Core::goBack();
} else {
$template['TITLE'] = dgettext('block', 'New Block');
$template['CONTENT'] = Block_Admin::edit($block, TRUE);
$template['MESSAGE'] = dgettext('block', 'Block must have a title, some content, or a file attachment.');
$content = PHPWS_Template::process($template, 'block', 'admin.tpl');
Layout::nakedDisplay($content);
}
break;
case 'lock':
$result = Block_Admin::lockBlock($_GET['block_id'], $_GET['key_id']);
if (PHPWS_Error::isError($result)) {
PHPWS_Error::log($result);
}
PHPWS_Core::goBack();
break;
case 'list':
$title = dgettext('block', 'Block list');
$content = Block_Admin::blockList();
break;
case 'js_block_edit':
$template['CONTENT'] = Block_Admin::edit($block, TRUE);
echo PHPWS_Template::process($template, 'block', 'admin.tpl');
exit;
break;
//.........这里部分代码省略.........
示例10: moveBoxMenu
public static function moveBoxMenu()
{
$box = new Layout_Box($_GET['box']);
$vars['action'] = 'admin';
$vars['command'] = 'moveBox';
$vars['box_source'] = $box->id;
$vars['box_dest'] = 'move_box_top';
$step_links[] = PHPWS_Text::secureLink(dgettext('layout', 'Move to top'), 'layout', $vars);
$vars['box_dest'] = 'move_box_up';
$step_links[] = PHPWS_Text::secureLink(dgettext('layout', 'Move up'), 'layout', $vars);
$vars['box_dest'] = 'move_box_down';
$step_links[] = PHPWS_Text::secureLink(dgettext('layout', 'Move down'), 'layout', $vars);
$vars['box_dest'] = 'move_box_bottom';
$step_links[] = PHPWS_Text::secureLink(dgettext('layout', 'Move to bottom'), 'layout', $vars);
if (Current_User::isDeity() && !$_SESSION['Layout_Settings']->deity_reload) {
$_SESSION['Layout_Settings']->loadSettings();
}
$themeVars = $_SESSION['Layout_Settings']->getAllowedVariables();
foreach ($themeVars as $var) {
if ($box->theme_var == $var) {
continue;
}
$vars['box_dest'] = $var;
$theme_links[] = PHPWS_Text::secureLink(sprintf(dgettext('layout', 'Send to %s'), $var), 'layout', $vars);
}
$vars['box_dest'] = 'restore';
$template['RESTORE'] = PHPWS_Text::secureLink(dgettext('layout', 'Restore to default'), 'layout', $vars);
$template['STEP_LINKS'] = implode('<br>', $step_links);
$template['THEME_LINKS'] = implode('<br>', $theme_links);
$template['CANCEL'] = sprintf('<a href="." onclick="window.close()">%s</a>', dgettext('layout', 'Cancel'));
$template['TITLE'] = sprintf(dgettext('layout', 'Move box: %s'), $box->content_var);
$content = PHPWS_Template::process($template, 'layout', 'move_box_select.tpl');
Layout::nakedDisplay($content);
}
示例11: admin
public static function admin()
{
if (!Current_User::allow('layout')) {
Current_User::disallow();
}
PHPWS_Core::initModClass('controlpanel', 'Panel.php');
$title = $content = null;
$panel = Layout_Admin::adminPanel();
if (isset($_REQUEST['command'])) {
$command = $_REQUEST['command'];
} else {
$command = $panel->getCurrentTab();
}
switch ($command) {
case 'arrange':
$title = dgettext('layout', 'Arrange Layout');
$content[] = Layout_Admin::arrangeForm();
break;
case 'post_style_change':
$result = Layout_Admin::postStyleChange();
if (PHPWS_Error::isError($result)) {
PHPWS_Error::log($result);
}
javascript('close_refresh');
break;
case 'reset_boxes':
if (!Current_User::authorized('layout')) {
Current_User::disallow();
}
Layout::resetDefaultBoxes();
unset($_SESSION['Layout_Settings']);
PHPWS_Core::reroute('index.php?module=layout&action=admin&authkey=' . Current_User::getAuthKey());
break;
case 'confirmThemeChange':
$title = dgettext('layout', 'Themes');
if (isset($_POST['confirm'])) {
Layout_Admin::changeTheme();
PHPWS_Core::reroute('index.php?module=layout&action=admin&tab=theme');
exit;
} else {
Layout::reset();
}
$content[] = Layout_Admin::adminThemes();
break;
case 'meta':
$title = dgettext('layout', 'Edit Meta Tags');
$content[] = Layout_Admin::metaForm();
break;
case 'clear_templates':
if (!Current_User::authorized('layout')) {
Current_User::disallow();
}
$files = PHPWS_File::readDirectory(PHPWS_SOURCE_DIR . 'templates/cache', false, true);
if (!empty($files) && is_array($files)) {
foreach ($files as $fn) {
$delete_cache_path = "templates/cache/{$fn}";
if (is_file($delete_cache_path)) {
unlink('templates/cache/' . $fn);
}
}
}
PHPWS_Core::goBack();
break;
case 'clear_cache':
if (!Current_User::authorized('layout')) {
Current_User::disallow();
}
PHPWS_Cache::clearCache();
PHPWS_Core::goBack();
break;
case 'moveBox':
$result = Layout_Admin::moveBox();
PHPWS_Error::logIfError($result);
exit;
javascript('close_refresh');
Layout::nakedDisplay();
break;
case 'postMeta':
if (!Current_User::authorized('layout')) {
Current_User::disallow();
}
Layout_Admin::postMeta();
if (isset($_POST['key_id'])) {
javascript('close_refresh');
Layout::nakedDisplay();
exit;
}
Layout::reset();
$title = dgettext('layout', 'Edit Meta Tags');
$template['MESSAGE'] = dgettext('layout', 'Meta Tags updated.');
$content[] = Layout_Admin::metaForm();
break;
case 'demo_fail':
unset($_SESSION['Layout_Settings']);
Layout::checkSettings();
PHPWS_Core::reroute('index.php?module=layout&action=admin&command=confirmThemeChange');
break;
case 'demo_theme':
$title = dgettext('layout', 'Confirm Theme Change');
$content[] = dgettext('layout', 'If you are happy with the change, click the appropiate button.');
//.........这里部分代码省略.........
示例12: javascriptEnabled
case 'update_core':
$content[] = $backToBoost . '<br />';
$content[] = Boost_Action::updateModule('core');
break;
case 'update':
$js = javascriptEnabled();
if (!$js) {
$content[] = $backToBoost . '<br />';
} else {
$content[] = sprintf('<p style="text-align : center"><input type="button" onclick="closeWindow(); return false" value="%s" /></p>', dgettext('boost', 'Close window'));
}
$content[] = Boost_Action::updateModule($_REQUEST['opmod']);
break;
case 'show_dependency':
$js = javascriptEnabled();
$content[] = Boost_Action::showDependency($_REQUEST['opmod']);
break;
case 'show_depended_upon':
$content[] = Boost_Action::showDependedUpon($_REQUEST['opmod']);
break;
}
// End area switch
if ($js) {
javascript('close_refresh', array('use_link' => true));
$content[] = sprintf('<p style="text-align : center"><input type="button" onclick="closeWindow(); return false" value="%s" /></p>', dgettext('boost', 'Close window'));
Layout::nakedDisplay(implode('', $content));
} else {
$boostPanel->setContent(implode('', $content));
$finalContent = $boostPanel->display();
Layout::add(PHPWS_ControlPanel::display($finalContent));
}
示例13: postDocumentUpload
public function postDocumentUpload()
{
// importPost in File_Common
$result = $this->document->importPost('file_name');
if (PHPWS_Error::isError($result)) {
PHPWS_Error::log($result);
$vars['timeout'] = '3';
$vars['refresh'] = 0;
javascript('close_refresh', $vars);
return dgettext('filecabinet', 'An error occurred when trying to save your document.');
} elseif ($result) {
$result = $this->document->save();
if (PHPWS_Error::logIfError($result)) {
$content = dgettext('filecabinet', '<p>Could not upload file to folder. Please check your directory permissions.</p>');
$content .= sprintf('<a href="#" onclick="window.close(); return false">%s</a>', dgettext('filecabinet', 'Close this window'));
Layout::nakedDisplay($content);
exit;
}
PHPWS_Core::initModClass('filecabinet', 'File_Assoc.php');
// This function doesn't do anything
//FC_File_Assoc::updateTag(FC_DOCUMENT, $this->document->id, $this->document->getTag());
$this->document->moveToFolder();
if (!isset($_POST['im'])) {
javascript('close_refresh');
} else {
javascriptMod('filecabinet', 'refresh_manager', array('document_id' => $this->document->id));
}
} else {
foreach ($this->document->_errors as $err) {
$message[] = $err->getMessage();
}
Cabinet::setMessage($this->document->printErrors());
}
}
示例14: auto_assign
//.........这里部分代码省略.........
array_unshift($applicants, $a);
continue;
}
if ($a->gender != $b->gender) {
array_unshift($applicants, $b);
$b = NULL;
continue;
}
$ass = HMS_Assignment::get_assignment($a->username, $term);
if (is_a($ass, 'HMS_Assignment')) {
$bbc = $ass->get_banner_building_code();
$bed = $ass->get_banner_bed_id();
$assigns[] = "Could not assign <strong>{$a->username}</strong>; already assigned to <strong>{$bbc} {$bed}</strong>";
array_unshift($applicants, $b);
continue;
}
$ass = HMS_Assignment::get_assignment($b->username, $term);
if (is_a($ass, 'HMS_Assignment')) {
$bbc = $ass->get_banner_building_code();
$bed = $ass->get_banner_bed_id();
$assigns[] = "Could not assign <strong>{$b->username}</strong>; already assigned to <strong>{$bbc} {$bed}</strong>";
array_unshift($applicants, $a);
continue;
}
// Determine Room Gender
$room = $a->gender == FEMALE ? array_shift($f_rooms) : ($a->gender == MALE ? array_shift($m_rooms) : 'badgender');
// We could be out of rooms or have database corruption
if (is_null($room)) {
$problems[] = "Could not assign <strong>{$a->username}</strong>; out of " . ($a->gender ? 'male' : 'female') . ' rooms.';
$problems[] = "Could not assign <strong>{$b->username}</strong>; out of " . ($b->gender ? 'male' : 'female') . ' rooms.';
continue;
} else {
if ($room === 'badgender') {
$problems[] = "Could not assign <strong>{$a->username}</strong>; {$a->gender} is not a valid gender.";
continue;
}
}
// Prepare for assignment
$room =& new HMS_Room($room);
$room->loadBeds();
$bed_a_text = $room->_beds[0]->get_banner_building_code() . ' ' . $room->_beds[0]->banner_id;
$bed_b_text = $room->_beds[1]->get_banner_building_code() . ' ' . $room->_beds[1]->banner_id;
if ($test) {
$successes[] = HMS_Autoassigner::record_success('TEST Auto', $a, $b, $bed_a_text);
$successes[] = HMS_Autoassigner::record_success('TEST Auto', $b, $a, $bed_b_text);
} else {
$result = HMS_Autoassigner::assign($a, $room->_beds[0], $term);
if ($result === TRUE) {
$successes[] = HMS_Autoassigner::record_success('Auto', $a, $b, $bed_a_text);
$assigned[] = $a->username;
} else {
$problems[] = $result;
}
if (!is_null($b->id)) {
$result = HMS_Autoassigner::assign($b, $room->_beds[1], $term);
if ($result === TRUE) {
$successes[] = HMS_Autoassigner::record_success('Auto', $b, $a, $bed_b_text);
$assigned[] = $b->username;
} else {
$problems[] = $result;
}
}
}
}
$f_f_count = count($f_rooms);
$f_m_count = count($m_rooms);
usort($successes, array('HMS_Autoassigner', 'sort_successes'));
$content = '<h1>Autoassigner Results - ' . date('Y-m-d') . '</h1>';
$content .= '<h2>Total Assignments: ' . count($assigned) . '</h2>';
$content .= "<p>Began with {$i_f_count} female rooms and {$i_m_count} male rooms</p>";
$content .= "<p>Ended with {$f_f_count} female rooms and {$f_m_count} male rooms</p>";
$content .= '<h2>Assignment Report (' . count($successes) . ')</h2>';
$content .= '<table><tr>';
$content .= '<th>Type</th><th>Bed A</th><th>Code A</th><th>Bed B</th><th>Code B</th><th>Room</th>';
$content .= '</tr>';
foreach ($successes as $success) {
$content .= '<tr>';
$content .= '<td>' . $success['type'] . '</td>';
$content .= '<td>' . $success['a'] . '</td>';
$content .= '<td>' . $success['a_code'] . '</td>';
$content .= '<td>' . $success['room'] . '</td>';
$content .= '<td>' . $success['b'] . '</td>';
$content .= '<td>' . $success['b_code'] . '</td>';
$content .= "</tr>\n";
}
$content .= '</tr></table>';
sort($problems);
$content .= '<h2>Problems (' . count($problems) . ')</h2>';
$content .= implode("<br />\n", $problems);
sort($rlcs);
$content .= '<h2>Skipped for RLC (' . count($rlcs) . ')</h2>';
$content .= implode("<br />\n", $rlcs);
sort($assigns);
$content .= '<h2>Skipped, already assigned (' . count($assigns) . ')</h2>';
$content .= implode("<br />\n", $assigns);
sort($notices);
$content .= '<h2>Notices (' . count($notices) . ')</h2>';
$content .= implode("<br />\n", $notices);
Layout::nakedDisplay($content, NULL, TRUE);
}
示例15: 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();
}
}