本文整理汇总了PHP中PageLayout::postError方法的典型用法代码示例。如果您正苦于以下问题:PHP PageLayout::postError方法的具体用法?PHP PageLayout::postError怎么用?PHP PageLayout::postError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PageLayout
的用法示例。
在下文中一共展示了PageLayout::postError方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getStepTemplate
/**
* Returns the Flexi template for entering the necessary values
* for this step.
*
* @param Array $values Pre-set values
* @param int $stepnumber which number has the current step in the wizard?
* @param String $temp_id temporary ID for wizard workflow
* @return String a Flexi template for getting needed data.
*/
public function getStepTemplate($values, $stepnumber, $temp_id)
{
// We only need our own stored values here.
$values = $values[__CLASS__];
// Load template from step template directory.
$factory = new Flexi_TemplateFactory($GLOBALS['STUDIP_BASE_PATH'] . '/app/views/course/wizard/steps');
$tpl = $factory->open('studyareas/index');
if ($values['studyareas']) {
$tree = $this->buildPartialSemTree(StudipStudyArea::backwards(StudipStudyArea::findMany($values['studyareas'])), false);
$tpl->set_attribute('assigned', $tree);
} else {
$tpl->set_attribute('assigned', array());
}
$tpl->set_attribute('values', $values);
// First tree level is always shown.
$tree = StudipStudyArea::findByParent(StudipStudyArea::ROOT);
if (count($tree) == 0) {
PageLayout::postError(formatReady(_('Das Anlegen einer ' . 'Veranstaltung ist nicht möglich, da keine Studienbereiche ' . 'existieren. Bitte wenden Sie sich an [die ' . 'Stud.IP-Administration]' . URLHelper::getLink('dispatch.php/siteinfo/show') . ' .')));
return false;
}
/*
* Someone works without JS activated, load all ancestors and
* children of open node.
*/
if ($values['open_node']) {
$tpl->set_attribute('open_nodes', $this->buildPartialSemTree(StudipStudyArea::backwards(StudipStudyArea::findByParent($values['open_node'])), false, true));
}
/*
* Someone works without JS and has entered a search term:
* build the partial tree with search results.
*/
if ($values['searchterm']) {
$search = $this->searchSemTree($values['searchterm'], false, true);
if ($search) {
$tpl->set_attribute('open_nodes', $search);
$tpl->set_attribute('search_result', $search);
unset($values['open_node']);
} else {
PageLayout::postMessage(MessageBox::info(_('Es wurde kein Suchergebnis gefunden.')));
unset($values['searchterm']);
}
}
$tpl->set_attribute('tree', $tree);
$tpl->set_attribute('ajax_url', $values['ajax_url'] ?: URLHelper::getLink('dispatch.php/course/wizard/ajax'));
$tpl->set_attribute('no_js_url', $values['no_js_url'] ?: 'dispatch.php/course/wizard/forward/' . $stepnumber . '/' . $temp_id);
$tpl->set_attribute('stepnumber', $stepnumber);
$tpl->set_attribute('temp_id', $temp_id);
return $tpl->render();
}
示例2: save_action
/**
* Saves the given user list to database.
*
* @param String $userlistId user list to save
*/
public function save_action($userlistId = '')
{
CSRFProtection::verifyUnsafeRequest();
$userlist = new AdmissionUserList($userlistId);
$userlist->setName(Request::get('name'))->setFactor(Request::float('factor'))->setUsers(Request::getArray('users'))->setOwnerId($GLOBALS['user']->id);
if ($userlist->store()) {
PageLayout::postSuccess(_('Die Personenliste wurde gespeichert.'));
} else {
PageLayout::postError(_('Die Personenliste konnte nicht gespeichert werden.'));
}
$this->redirect('admission/userlist');
}
示例3: delete_boss_action
/**
* Remove yourself as default deputy of the given boss.
* @param $boss_id
*/
public function delete_boss_action($boss_id)
{
if (deleteDeputy($GLOBALS['user']->id, $boss_id)) {
PageLayout::postSuccess(sprintf(_('Sie wurden als Standardvertretung von %s entfernt.'), User::find($boss_id)->getFullname()));
} else {
PageLayout::postError(sprintf(_('Sie konnten nicht als Standardvertretung von %s entfernt werden.'), User::find($boss_id)->getFullname()));
}
$this->redirect($this->url_for('my_courses'));
}
示例4: switchdeputy_action
public function switchdeputy_action($course_id, $newstatus)
{
$course = Seminar::getInstance($course_id);
switch ($newstatus) {
case 'dozent':
$dozent = new CourseMember();
$dozent->seminar_id = $course_id;
$dozent->user_id = $GLOBALS['user']->id;
$dozent->status = 'dozent';
$dozent->comment = '';
if ($dozent->store()) {
deleteDeputy($GLOBALS['user']->id, $course_id);
PageLayout::postSuccess(sprintf(_('Sie wurden als %s eingetragen.'), get_title_for_status('dozent', 1)));
} else {
PageLayout::postError(sprintf(_('Sie konnten nicht als %s eingetragen werden.'), get_title_for_status('dozent', 1)));
}
break;
case 'deputy':
$dozent = Course::find($course_id)->members->findOneBy('user_id', $GLOBALS['user']->id);
if (addDeputy($GLOBALS['user']->id, $course_id)) {
$dozent->delete();
PageLayout::postSuccess(_('Sie wurden als Vertretung eingetragen.'));
} else {
PageLayout::postError(_('Sie konnten nicht als Vertretung eingetragen werden.'));
}
break;
}
$this->flash['open'] = "bd_personal";
$this->redirect($this->url_for('course/basicdata/view/' . $course_id));
}
示例5: new_action
/**
* Create a new Datafield
*
* @param $type static types for datafields
*/
public function new_action($type = null)
{
if (Request::submitted('anlegen')) {
if (Request::get('datafield_name')) {
$datafield = new DataField();
$datafield->name = Request::get('datafield_name');
$datafield->object_type = $type;
$datafield->object_class = array_sum(Request::getArray('object_class'));
$datafield->edit_perms = Request::get('edit_perms');
$datafield->view_perms = Request::get('visibility_perms');
$datafield->system = Request::int('system') ?: 0;
$datafield->priority = Request::int('priority') ?: 0;
$datafield->type = Request::get('datafield_typ');
$datafield->is_userfilter = Request::int('is_userfilter') ?: 0;
if ($type === 'sem') {
$datafield->description = Request::get('description', '');
$datafield->is_required = Request::int('is_required') ?: 0;
} else {
$datafield->description = '';
$datafield->is_required = Request::int('is_required') ?: 0;
}
$datafield->store();
PageLayout::postSuccess(_('Das neue generische Datenfeld wurde angelegt.'));
$this->redirect('admin/datafields/index/' . $datafield->object_type . '#item_' . $datafield->id);
return;
} else {
PageLayout::postError(_('Es wurde keine Bezeichnung eingetragen!'));
}
}
$type = $type ?: Request::get('datafield_typ');
$this->type_name = $this->allclasses[$type];
$this->object_typ = $type;
if (!$this->object_typ) {
$this->render_action('type_select');
}
}