Exemple #1
0
 /**
  * Execute the action
  */
 public function execute()
 {
     $this->id = $this->getParameter('id', 'int');
     $error = $this->getParameter('error', 'string');
     $this->loadAuthenticatedUser();
     // If id and error parameters are not set we'll assume the user logged in
     // and has been redirected to this action by the authentication index action.
     // When this is the case the user will be redirected to the index action of this module.
     // An action to which he may not have any user rights.
     // Redirect to the user's own profile instead to avoid unnessary words.
     if ($this->id === null && $error === null && $this->authenticatedUser->getUserId()) {
         $this->redirect(BackendModel::createURLForAction('Edit') . '&id=' . $this->authenticatedUser->getUserId());
     }
     // does the user exists
     if ($this->id !== null && BackendUsersModel::exists($this->id)) {
         parent::execute();
         $this->record = (array) BackendUsersModel::get($this->id);
         $this->loadForm();
         $this->validateForm();
         $this->parse();
         $this->display();
     } else {
         $this->redirect(BackendModel::createURLForAction('Index') . '&error=non-existing');
     }
 }
 public function execute()
 {
     parent::execute();
     try {
         $id = Uuid::fromString($this->getParameter('id', 'string'));
         $teamMember = $this->get('team_repository')->find($id);
     } catch (\Exception $e) {
         return $this->redirect(Model::createURLForAction('Index') . '&error=non-existing');
     }
     $form = new TeamType('edit', $teamMember);
     if ($form->handle()) {
         $teamMember = $form->getData();
         $this->get('team_repository')->save($teamMember);
         return $this->redirect(Model::createURLForAction('Index') . '&report=edited' . '&highlight=row-' . $teamMember->getId());
     }
     // assign the detail url to the template if available
     $url = Model::getURLForBlock($this->URL->getModule(), 'Detail');
     if (Model::getURL(404) != $url) {
         $this->tpl->assign('detailURL', SITE_URL . $url);
     }
     $form->parse($this->tpl);
     $this->tpl->assign('teamMember', $teamMember->toArray());
     $this->parse();
     $this->display();
 }
Exemple #3
0
 /**
  * Execute the action
  */
 public function execute()
 {
     $this->id = $this->getParameter('id', 'int');
     // does the item exists
     if ($this->id !== null && BackendLocationModel::exists($this->id)) {
         $this->header->addJS(FrontendLocationModel::getPathToMapStyles());
         parent::execute();
         // define Google Maps API key
         $apikey = $this->get('fork.settings')->get('Core', 'google_maps_key');
         // check Google Maps API key, otherwise redirect to settings
         if ($apikey === null) {
             $this->redirect(BackendModel::createURLForAction('Index', 'Settings'));
         }
         // add js
         $this->header->addJS('https://maps.googleapis.com/maps/api/js?key=' . $apikey, null, false, true, false);
         $this->loadData();
         $this->loadForm();
         $this->validateForm();
         $this->loadSettingsForm();
         $this->parse();
         $this->display();
     } else {
         $this->redirect(BackendModel::createURLForAction('Index') . '&error=non-existing');
     }
 }
 /**
  * Execute the action
  */
 public function execute()
 {
     parent::execute();
     $this->getCompressionParameters();
     $this->parse();
     $this->display();
 }
 /**
  * Execute the action
  */
 public function execute()
 {
     parent::execute();
     $this->loadData();
     $this->parse();
     $this->display();
 }
 /**
  * Execute the action
  *
  * @return  void
  */
 public function execute()
 {
     // get parameters
     $this->id = $this->getParameter('id', 'int');
     // does the item exists
     if ($this->id !== null && BackendSlideshowModel::existsGallery($this->id)) {
         // call parent, this will probably add some general CSS/JS or other required files
         parent::execute();
         // get all data for the item we want to edit
         $this->getData();
         // load the form
         $this->loadForm();
         // load datagrids
         $this->loadDataGrid();
         // validate the form
         $this->validateForm();
         // parse
         $this->parse();
         // display the page
         $this->display();
     } else {
         // no item found, throw an exception, because somebody is f*****g with our URL
         $this->redirect(BackendModel::createURLForAction('Index') . '&error=non-existing');
     }
 }
 public function execute()
 {
     // get parameters
     $this->id = $this->getParameter('id', 'int');
     // does the item exists?
     if ($this->id !== null && BackendGalleriaModel::existsAlbum($this->id)) {
         // call parent, this will probably add some general CSS/JS or other required files
         parent::execute();
         // get all data for the item we want to edit
         $this->getData();
         // load the form
         $this->loadForm();
         $this->loadFormAddImage();
         $this->loadFormDeleteImage();
         // validate the form
         $this->validateForm();
         $this->validateFormAddImage();
         $this->validateFormDeleteImage();
         // parse the form
         $this->parse();
         // display the page
         $this->display();
     } else {
         $this->redirect(BackendModel::createURLForAction('albums') . '&error=non-existing');
     }
 }
Exemple #8
0
 /**
  * Execute the action
  */
 public function execute()
 {
     parent::execute();
     // load record
     $this->loadData();
     // add js
     $this->header->addJS('jstree/jquery.tree.js', null, false);
     $this->header->addJS('jstree/lib/jquery.cookie.js', null, false);
     $this->header->addJS('jstree/plugins/jquery.tree.cookie.js', null, false);
     // add css
     $this->header->addCSS('/src/Backend/Modules/Pages/Js/jstree/themes/fork/style.css', null, true);
     // get the templates
     $this->templates = BackendExtensionsModel::getTemplates();
     // set the default template as checked
     $this->templates[$this->record['template_id']]['checked'] = true;
     // homepage?
     if ($this->id == 1) {
         // loop and set disabled state
         foreach ($this->templates as &$row) {
             $row['disabled'] = $row['has_block'];
         }
     }
     // get the extras
     $this->extras = BackendExtensionsModel::getExtras();
     $this->loadForm();
     $this->loadDrafts();
     $this->loadRevisions();
     $this->validateForm();
     $this->parse();
     $this->display();
 }
Exemple #9
0
 /**
  * Execute the action
  */
 public function execute()
 {
     parent::execute();
     $this->loadForm();
     $this->validateForm();
     $this->parse();
     $this->display();
 }
 /**
  * Execute the action
  */
 public function execute()
 {
     parent::execute();
     set_time_limit(0);
     $this->fs = new Filesystem();
     $this->loadForm();
     $this->validateForm();
     $this->parse();
     $this->display();
 }
 /**
  * Execute the action
  */
 public function execute()
 {
     parent::execute();
     $this->header->addJS('ThemeTemplate.js');
     $this->loadData();
     $this->loadForm();
     $this->validateForm();
     $this->parse();
     $this->display();
 }
Exemple #12
0
 /**
  * Execute the action
  */
 public function execute()
 {
     parent::execute();
     $this->groupId = \SpoonFilter::getGetValue('group_id', null, 0, 'int');
     $this->downloadExampleFile();
     $this->loadForm();
     $this->validateForm();
     $this->parse();
     $this->display();
 }
Exemple #13
0
 /**
  * Execute the action
  */
 public function execute()
 {
     parent::execute();
     $this->loadData();
     $this->loadForm();
     $this->validateForm();
     $this->header->addJsData("Media", "mediaModule", (string) $this->getModule());
     $this->header->addJsData("Media", "mediaAction", (string) $this->getAction());
     $this->header->addJsData("Media", "mediaId", (int) $this->id);
     $this->header->addJsData("Media", "mediaType", (string) 'Agenda');
     $this->parse();
     $this->display();
 }
 /**
  * Execute the action
  */
 public function execute()
 {
     $this->id = $this->getParameter('id', 'int');
     // does the item exist
     if (BackendMailmotorModel::existsMailing($this->id)) {
         parent::execute();
         $this->getData();
         $this->parse();
         $this->display(BACKEND_MODULES_PATH . '/Mailmotor/Layout/Templates/EditMailingIframe.tpl');
     } else {
         $this->redirect(BackendModel::createURLForAction('Index') . '&error=non-existing');
     }
 }
Exemple #15
0
 /**
  * Execute the action
  */
 public function execute()
 {
     $this->id = $this->getParameter('id', 'int');
     if ($this->id !== null && BackendCatalogModel::existsFile($this->id)) {
         parent::execute();
         $this->getData();
         $this->loadForm();
         $this->validateForm();
         $this->parse();
         $this->display();
     } else {
         $this->redirect(BackendModel::createURLForAction('index') . '&error=non-existing');
     }
 }
Exemple #16
0
 /**
  * Execute the action
  */
 public function execute()
 {
     // call parent, this will probably add some general CSS/JS or other required files
     parent::execute();
     $this->getData();
     $this->loadAccountForm();
     $this->loadClientForm();
     $this->loadGeneralForm();
     $this->validateAccountForm();
     $this->validateClientForm();
     $this->validateGeneralForm();
     $this->parse();
     $this->display();
 }
Exemple #17
0
 /**
  * Execute the action
  */
 public function execute()
 {
     $this->id = $this->getParameter('id', 'int');
     // does the item exist?
     if ($this->id !== null && BackendFaqModel::existsCategory($this->id)) {
         parent::execute();
         $this->getData();
         $this->loadForm();
         $this->validateForm();
         $this->parse();
         $this->display();
     } else {
         $this->redirect(BackendModel::createURLForAction('Categories') . '&error=non-existing');
     }
 }
Exemple #18
0
 /**
  * Execute the action
  */
 public function execute()
 {
     $this->email = $this->getParameter('email');
     // does the item exist
     if (BackendMailmotorModel::existsAddress($this->email)) {
         parent::execute();
         $this->getData();
         $this->loadForm();
         $this->loadCustomFields();
         $this->validateForm();
         $this->parse();
         $this->display();
     } else {
         $this->redirect(BackendModel::createURLForAction('Index') . '&error=non-existing');
     }
 }
 /**
  * Execute the action
  */
 public function execute()
 {
     // get parameters
     $this->id = $this->getParameter('id', 'int');
     // does the item exist
     if (BackendMailmotorModel::existsMailing($this->id)) {
         parent::execute();
         $this->getData();
         $this->loadForm();
         $this->validateForm();
         $this->parse();
         $this->display();
     } else {
         $this->redirect(BackendModel::createURLForAction('Index') . '&error=non-existing');
     }
 }
Exemple #20
0
 public function execute()
 {
     // get parameters
     $this->id = $this->getParameter('id', 'int');
     if ($this->id !== null && BackendHotelsModel::exists('hotels', $this->id)) {
         parent::execute();
         $this->getData();
         $this->loadForm();
         $this->validateForm();
         $this->parse();
         $this->display();
     } else {
         // no item found, throw an exception, because somebody is f*****g with our URL
         $this->redirect(BackendModel::createURLForAction('Index') . '&error=non-existing');
     }
 }
Exemple #21
0
 /**
  * Execute the action
  */
 public function execute()
 {
     $this->id = $this->getParameter('id', 'int');
     // does the item exist
     if ($this->id !== null && BackendFormBuilderModel::exists($this->id)) {
         parent::execute();
         $this->getData();
         $this->loadForm();
         $this->validateForm();
         $this->parse();
         $this->display();
     } else {
         // no item found, throw an exceptions, because somebody is f*****g with our url
         $this->redirect(BackendModel::createURLForAction('Index') . '&error=non-existing');
     }
 }
Exemple #22
0
 /**
  * Execute the action.
  */
 public function execute()
 {
     // get parameters
     $this->id = $this->getParameter('id', 'int');
     // does the item exists
     if ($this->id !== null && BackendProfilesModel::existsGroup($this->id)) {
         parent::execute();
         $this->getData();
         $this->loadForm();
         $this->validateForm();
         $this->parse();
         $this->display();
     } else {
         $this->redirect(BackendModel::createURLForAction('Groups') . '&error=non-existing');
     }
 }
Exemple #23
0
 /**
  * Execute the action
  */
 public function execute()
 {
     $this->id = $this->getParameter('id', 'int');
     // does the item exists
     if ($this->id !== null && BackendLocationModel::exists($this->id)) {
         parent::execute();
         // add js
         $this->header->addJS('http://maps.google.com/maps/api/js?sensor=false', null, false, true, false);
         $this->loadData();
         $this->loadForm();
         $this->validateForm();
         $this->loadSettingsForm();
         $this->parse();
         $this->display();
     } else {
         $this->redirect(BackendModel::createURLForAction('Index') . '&error=non-existing');
     }
 }
Exemple #24
0
 /**
  * Execute the action
  */
 public function execute()
 {
     // set force compile on because we're using multiple forms on 1 page
     $this->tpl->setForceCompile(true);
     // get parameters
     $this->id = $this->getParameter('id', 'int');
     // get the step
     $this->stepId = \SpoonFilter::getGetValue('step', array(1, 2, 3, 4), 1, 'int');
     // does the item exist
     if (BackendMailmotorModel::existsMailing($this->id)) {
         // call parent, this will probably add some general CSS/JS or other required files
         parent::execute();
         $this->getData();
         $this->loadWizardSteps();
         $this->{'loadStep' . $this->stepId}();
         $this->parse();
         $this->display();
     } else {
         $this->redirect(BackendModel::createURLForAction('Index') . '&error=non-existing');
     }
 }
Exemple #25
0
 /**
  * Execute the action
  */
 public function execute()
 {
     parent::execute();
     $this->contentBlock = $this->getContentBlock();
     if ($this->contentBlock === null) {
         return $this->redirect(BackendModel::createURLForAction('Index', null, null, ['error' => 'non-existing']));
     }
     $form = $this->createForm(new ContentBlockType($this->get('fork.settings')->get('Core', 'theme', 'core'), UpdateContentBlock::class), new UpdateContentBlock($this->contentBlock));
     $form->handleRequest($this->get('request'));
     if (!$form->isValid()) {
         $this->tpl->assign('form', $form->createView());
         $this->parse();
         $this->display();
         return;
     }
     /** @var UpdateContentBlock $updateContentBlock */
     $updateContentBlock = $form->getData();
     // The command bus will handle the saving of the content block in the database.
     $this->get('command_bus')->handle($updateContentBlock);
     $this->get('event_dispatcher')->dispatch(ContentBlockUpdated::EVENT_NAME, new ContentBlockUpdated($updateContentBlock->contentBlock));
     return $this->redirect(BackendModel::createURLForAction('Index', null, null, ['report' => 'edited', 'var' => $updateContentBlock->title, 'highlight' => 'row-' . $this->contentBlock->getId()]));
 }
Exemple #26
0
 /**
  * Execute the action
  */
 public function execute()
 {
     // get parameters
     $this->id = $this->getParameter('id', 'int');
     // does the item exists
     if ($this->id !== null && BackendBlogModel::exists($this->id)) {
         parent::execute();
         // set category id
         $this->categoryId = \SpoonFilter::getGetValue('category', null, null, 'int');
         if ($this->categoryId == 0) {
             $this->categoryId = null;
         }
         $this->getData();
         $this->loadDrafts();
         $this->loadRevisions();
         $this->loadForm();
         $this->validateForm();
         $this->parse();
         $this->display();
     } else {
         // no item found, throw an exception, because somebody is f*****g with our URL
         $this->redirect(BackendModel::createURLForAction('Index') . '&error=non-existing');
     }
 }
Exemple #27
0
 /**
  * Execute the action
  */
 public function execute()
 {
     // call parent, this will probably add some general CSS/JS or other required files
     parent::execute();
     ini_set('max_execution_time', 150);
     // Get all the modules
     $modules = BackendModel::getModules();
     // Check if modules is not empty
     if (!empty($modules)) {
         // Create filesystem object
         $filesystem = new Filesystem();
         // Loop the modules
         foreach ($modules as $module) {
             // Create var dir for ease of use
             $dir = FRONTEND_FILES_PATH . '/' . $module . '/Images/';
             // Check if dir exists
             if ($filesystem->exists($dir . 'Source/')) {
                 // Create Finder object
                 $finderDir = new Finder();
                 // Get all the dirs in the modules/images folder.
                 $dirs = $finderDir->directories()->in($dir)->exclude(array("Source", 'source'));
                 // Check if $dirs is not empty
                 if (!empty($dirs)) {
                     // Create Finder object for the files
                     $finderFiles = new Finder();
                     // Get all the files in the source-dir
                     $files = $finderFiles->files()->in($dir . 'Source/');
                     // Check if $files is not empty
                     if (!empty($files)) {
                         // Loop all the dirs
                         foreach ($dirs as $row) {
                             // Explode the dir-name
                             $chunks = explode("x", $row->getBasename(), 2);
                             // Create folder array
                             $folder = array();
                             $folder['dirname'] = $row->getBasename();
                             $folder['path'] = $row->getRealPath();
                             $folder['width'] = $chunks[0] != '' ? (int) $chunks[0] : null;
                             $folder['height'] = $chunks[1] != '' ? (int) $chunks[1] : null;
                             // Loop all the files
                             foreach ($files as $file) {
                                 set_time_limit(150);
                                 // Check if the file exists
                                 if (!$filesystem->exists($dir . $row->getBasename() . '/' . $file->getBasename())) {
                                     // generate the thumbnail
                                     $thumbnail = new \SpoonThumbnail($dir . 'Source/' . $file->getBasename(), $folder['width'], $folder['height']);
                                     $thumbnail->setAllowEnlargement(true);
                                     // if the width & height are specified we should ignore the aspect ratio
                                     if ($folder['width'] !== null && $folder['height'] !== null) {
                                         $thumbnail->setForceOriginalAspectRatio(false);
                                     }
                                     $thumbnail->parseToFile($folder['path'] . '/' . $file->getBasename());
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     echo "ok";
     die;
     // redirect
     //$this->redirect(BackendModel::createURLForAction('index') . '&report=generate_images');
 }