Beispiel #1
0
 public function action_edit()
 {
     $id = $this->request->param('id');
     $template = ORM::factory('email_template', $id);
     if (!$template->loaded()) {
         Messages::errors(__('Email template not found!'));
         $this->go(Route::get('email_controllers')->uri(array('controller' => 'templates')));
     }
     // check if trying to save
     if (Request::current()->method() == Request::POST) {
         return $this->_edit($template);
     }
     WYSIWYG::load_filters();
     $this->set_title(__('Edit email template'));
     $this->template_js_params['EMAIL_TEMPLATE_ID'] = $template->id;
     $this->template->content = View::factory('email/templates/edit', array('action' => 'edit', 'template' => $template));
 }
Beispiel #2
0
 public function action_view()
 {
     Assets::package('backbone');
     $id = (int) $this->request->query('id');
     $doc = $this->_get_document($id);
     WYSIWYG::load_filters();
     $this->_load_session_data($doc);
     $doc->onControllerLoad();
     $this->breadcrumbs->add($this->section()->name, Route::get('datasources')->uri(array('directory' => 'datasources', 'controller' => 'data')) . URL::query(array('ds_id' => $this->section()->id()), FALSE));
     $this->template_js_params['API_FORM_ACTION'] = '/datasource-document.' . ($doc->loaded() ? 'update' : 'create');
     $this->template_js_params['SECTION_ID'] = (int) $this->section()->id();
     $this->template_js_params['DOCUMENT_ID'] = $id;
     if (!$doc->loaded()) {
         $this->set_title(__('New document'));
     } else {
         $this->set_title($doc->header);
     }
     $this->_load_template($doc);
 }
Beispiel #3
0
 public function action_edit()
 {
     WYSIWYG::load_filters();
     Assets::package('backbone');
     $page_id = (int) $this->request->param('id');
     $page = ORM::factory('page', $page_id);
     if (!$page->loaded()) {
         Messages::errors(__('Page not found!'));
         $this->go();
     }
     // Проверка пользователя на доступ к редактированию текущей страницы
     if (!Auth::has_permissions($page->get_permissions())) {
         Messages::errors(__('You do not have permission to access the requested page!'));
         $this->go();
     }
     // check if trying to save
     if ($this->request->method() == Request::POST) {
         return $this->_edit($page);
     }
     $this->set_page_js_params($page);
     $this->set_title($page->title);
     $this->template->content = View::factory('page/edit', array('action' => 'edit', 'page' => $page, 'permissions' => ORM::factory('role')->find_all()->as_array('id', 'name'), 'page_permissions' => $page->get_permissions()));
 }