public function performHandlerTasks() { if (($author_id = Application::param('author_id')) && ($entry_id = Application::param('entry_id'))) { $entry = new Entry(); $entry->clauseSafe('author_id', $author_id); $entry->clauseSafe('entry_id', $entry_id); $this->entry_to_manage_for = $entry; } else { $this->redirectOnAccessDenied(); } if (!LogbookAccess::currentUserCanManageAccess($this->entryToManageFor())) { $this->redirectOnAccessDenied(); } if ($group_id = Application::param('group_id')) { $this->group_to_manage_for = new Group(); $this->group_to_manage_for->clauseSafe('group_id', $group_id); } if (Application::formPosted()) { if (Application::param('choose_group')) { $this->chooseGroup(); } if (Application::param('manage_access')) { $this->manageAccess(); } } }
public function performHandlerTasks() { if(Application::formPosted()) { if(Application::param('add_blog_comment')) $this->save(); } }
public function performHandlerTasks() { if(Application::formPosted()) { if(Application::param('edit_about_me')) $this->editAboutMe(); } }
public function performHandlerTasks() { if(!LogbookAccess::currentUserCanEdit($this->entryToEdit())) $this->redirectOnAccessDenied(); if(Application::formPosted()) { if(Application::param('edit_blog_entry')) $this->doEdit(); else if(Application::param('delete_blog_entry')) $this->deleteBlogEntry(); } }
public function performHandlerTasks() { if(Application::formPosted()) { if(!Application::param('cancel_edit')) { $this->savePart(); } else if(Application::param('cancel_edit')) { Application::setUrlParam('module_id',Application::param('module_id')); Application::redirect('ModuleDetail'); } } }
public function performHandlerTasks() { if (Application::formPosted()) { $form = Form::load('seeingsystem.views.Login'); if ($form->validate()) { try { PilotApplication::login(Application::param('user_email'), Application::param('user_password')); } catch (UserNotFoundException $exc) { $this->login_error = 'No user with that email is registered'; } catch (InvalidPasswordException $exc) { $this->login_error = 'The password was incorrect'; } } } else { if (Application::param('logout')) { PIlotApplication::logout(); } } }
public function display($vars) { $disp = new Display(); if (!$vars || is_array($vars) && !count($vars)) { $vars = array('dumb', 'dumber'); } $disp->setFilter($vars, '$$'); if (Application::formPosted()) { $params = Application::post(); } else { $params = ''; } $disp->setValue('form_name', $this->name); $disp->setValue('form_action', Display::current()->hrefString($this->handler)); foreach ($this->inputs as $inp) { if (!$this->clear) { $name = $inp->name(); if ($inp->valueOverride()) { $value = $inp->value(); } else { if ($params) { $value = Form::getValueFromArray($name, $params); } else { $value = $inp->value(); } } } else { $value = ''; } if ($inp->allowsOptions()) { if ($value === '' && !$this->clear) { $value = $inp->selected; } $inp->setSelected($value); $options = $inp->generateInputObjects(); $disp->setValue($inp->name() . '_options', $options); } else { if ($inp->getClass() == 'FileInput' || $inp->getClass() == 'ImageInput') { $disp->setValue($inp->name() . '_existing_file', $inp->value()); } else { if ($inp->getClass() == 'DateInput') { if ($params && $value !== '') { $day = ArrayUtility::getArrayValue($value, 'day'); $month = ArrayUtility::getArrayValue($value, 'month'); $year = ArrayUtility::getArrayValue($value, 'year'); } else { if ($value !== '') { //$inp->setValue($value); $day = $inp->day(); $month = $inp->month(); $year = $inp->year(); } else { if (!$this->clear) { $day = $inp->day(); $month = $inp->month(); $year = $inp->year(); } else { $year = ''; $month = ''; $day = ''; } } } $disp->setValue($inp->name() . '_year_value', $year); $disp->setValue($inp->name() . '_month_value', $month); $disp->setValue($inp->name() . '_day_value', $day); } else { if ($value === '' && !is_numeric($value) && !$this->clear || $inp instanceof HiddenInput && !$this->clear) { $value = $inp->value(); } $disp->setValue($inp->name() . '_value', $value); } } } } $new_path = ''; if (is_array($vars) && count($vars)) { $path = Application::CACHE . Form::cachePath($this->initPath()) . '.t'; $new_path = Application::CACHE . 'dead-' . time() . '-' . Form::cachePath($this->initPath()) . '.t'; $data = file_get_contents($path); foreach ($vars as $name => $value) { $data = str_replace('$$' . strtoupper(str_replace('-', '_', $name)) . '$$', $value, $data); } $data = preg_replace('/\\$\\$[A-Z_]*\\$\\$/', '', $data); @unlink($new_path); file_put_contents($new_path, $data); chmod($new_path, 0664); $path = $new_path; } else { $path = Application::CACHE . Form::cachePath($this->initPath()) . '.t'; } foreach ($this->widgets() as $widg) { $widg->registerJavascript($disp); } $disp->displayPage($path); if ($new_path) { unlink($new_path); } }
function buttonClicked($name) { $ret = FALSE; if (Application::formPosted()) { if (isset($_POST[$name]) || isset($_POST[$name . '_x']) || isset($_POST[$name . '_y'])) { $ret = TRUE; } } return $ret; }
public function performHandlerTasks() { if (Application::formPosted()) { $this->mapView(); } }