getWorkingLanguage() public static method

Get the current working language
Deprecation:
public static getWorkingLanguage ( ) : string
return string
Beispiel #1
0
 /**
  * Loads the dataGrids
  */
 private function loadDatagrids()
 {
     // load all categories
     $categories = BackendFaqModel::getCategories(true);
     // loop categories and create a dataGrid for each one
     foreach ($categories as $categoryId => $categoryTitle) {
         $dataGrid = new BackendDataGridDB(BackendFaqModel::QRY_DATAGRID_BROWSE, array(BL::getWorkingLanguage(), $categoryId));
         $dataGrid->setAttributes(array('class' => 'dataGrid sequenceByDragAndDrop'));
         $dataGrid->setColumnsHidden(array('category_id', 'sequence'));
         $dataGrid->addColumn('dragAndDropHandle', null, '<span>' . BL::lbl('Move') . '</span>');
         $dataGrid->setColumnsSequence('dragAndDropHandle');
         $dataGrid->setColumnAttributes('question', array('class' => 'title'));
         $dataGrid->setColumnAttributes('dragAndDropHandle', array('class' => 'dragAndDropHandle'));
         $dataGrid->setRowAttributes(array('id' => '[id]'));
         // check if this action is allowed
         if (BackendAuthentication::isAllowedAction('Edit')) {
             $dataGrid->setColumnURL('question', BackendModel::createURLForAction('Edit') . '&amp;id=[id]');
             $dataGrid->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('Edit') . '&amp;id=[id]', BL::lbl('Edit'));
         }
         // add dataGrid to list
         $this->dataGrids[] = array('id' => $categoryId, 'title' => $categoryTitle, 'content' => $dataGrid->getContent());
     }
     // set empty datagrid
     $this->emptyDatagrid = new BackendDataGridArray(array(array('dragAndDropHandle' => '', 'question' => BL::msg('NoQuestionInCategory'), 'edit' => '')));
     $this->emptyDatagrid->setAttributes(array('class' => 'dataGrid sequenceByDragAndDrop emptyGrid'));
     $this->emptyDatagrid->setHeaderLabels(array('edit' => null, 'dragAndDropHandle' => null));
 }
Beispiel #2
0
 /**
  * Validate the form
  */
 private function validateForm()
 {
     // is the form submitted?
     if ($this->frm->isSubmitted()) {
         // cleanup the submitted fields, ignore fields that were added by hackers
         $this->frm->cleanupFields();
         // validate field
         $this->frm->getField('synonym')->isFilled(BL::err('SynonymIsRequired'));
         $this->frm->getField('term')->isFilled(BL::err('TermIsRequired'));
         if (BackendSearchModel::existsSynonymByTerm($this->frm->getField('term')->getValue())) {
             $this->frm->getField('term')->addError(BL::err('TermExists'));
         }
         // no errors?
         if ($this->frm->isCorrect()) {
             // build item
             $item = array();
             $item['term'] = $this->frm->getField('term')->getValue();
             $item['synonym'] = $this->frm->getField('synonym')->getValue();
             $item['language'] = BL::getWorkingLanguage();
             // insert the item
             $id = BackendSearchModel::insertSynonym($item);
             // trigger event
             BackendModel::triggerEvent($this->getModule(), 'after_add_synonym', array('item' => $item));
             // everything is saved, so redirect to the overview
             $this->redirect(BackendModel::createURLForAction('Synonyms') . '&report=added-synonym&var=' . urlencode($item['term']) . '&highlight=row-' . $id);
         }
     }
 }
 /**
  * Retrieve the unique URL for an teamMember
  *
  * @param string $url
  * @param int $id The id of the teamMember to ignore.
  * @return string
  */
 public static function getUrl($url, $id = null)
 {
     $url = CommonUri::getUrl((string) $url);
     $database = BackendModel::get('database');
     if ($id === null) {
         $urlExists = (bool) $database->getVar('SELECT 1
                FROM team_members AS i
                     INNER JOIN meta AS m
                     ON i.meta_id = m.id
               WHERE i.language = ? AND m.url = ?
               LIMIT 1', [Language::getWorkingLanguage(), $url]);
     } else {
         $urlExists = (bool) $database->getVar('SELECT 1
                FROM team_members AS i
                     INNER JOIN meta AS m
                     ON i.meta_id = m.id
               WHERE i.language = ? AND m.url = ? AND i.id != ?
               LIMIT 1', [Language::getWorkingLanguage(), $url, $id]);
     }
     if ($urlExists) {
         $url = Model::addNumber($url);
         return self::getUrl($url, $id);
     }
     return $url;
 }
 /**
  * Load the datagrids
  *
  * @return  void
  */
 private function loadDataGrids()
 {
     // load all categories that are in use
     $categories = BackendSlideshowModel::getActiveCategories(true);
     // run over categories and create datagrid for each one
     foreach ($categories as $categoryId => $categoryTitle) {
         // create datagrid
         $dataGrid = new BackendDataGridDB(BackendSlideshowModel::QRY_DATAGRID_BROWSE, array(BL::getWorkingLanguage(), $categoryId));
         // disable paging
         $dataGrid->setPaging(false);
         // set colum URLs
         $dataGrid->setColumnURL('title', BackendModel::createURLForAction('Edit') . '&amp;id=[id]');
         // set column functions
         $dataGrid->setColumnFunction(array(new BackendDataGridFunctions(), 'getLongDate'), array('[publish_on]'), 'publish_on', true);
         $dataGrid->setColumnFunction(array(new BackendDataGridFunctions(), 'getUser'), array('[user_id]'), 'user_id', true);
         // set headers
         $dataGrid->setHeaderLabels(array('user_id' => \SpoonFilter::ucfirst(BL::lbl('Author')), 'publish_on' => \SpoonFilter::ucfirst(BL::lbl('PublishedOn'))));
         // enable drag and drop
         $dataGrid->enableSequenceByDragAndDrop();
         // our JS needs to know an id, so we can send the new order
         $dataGrid->setRowAttributes(array('id' => '[id]'));
         $dataGrid->setAttributes(array('data-action' => "GallerySequence"));
         // create a column #images
         $dataGrid->addColumn('images', ucfirst(BL::lbl('Images')));
         $dataGrid->setColumnFunction(array('Backend\\Modules\\Slideshow\\Engine\\Model', 'getImagesByGallery'), array('[id]', true), 'images', true);
         // hide columns
         $dataGrid->setColumnsHidden(array('category_id', 'sequence', 'filename'));
         // add edit column
         $dataGrid->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('Edit') . '&amp;id=[id]', BL::lbl('Edit'));
         // set column order
         $dataGrid->setColumnsSequence('dragAndDropHandle', 'title', 'images', 'user_id', 'publish_on', 'edit');
         // add dataGrid to list
         $this->dataGrids[] = array('id' => $categoryId, 'title' => $categoryTitle, 'content' => $dataGrid->getContent());
     }
 }
Beispiel #5
0
 /**
  * Validate the form
  */
 private function validateForm()
 {
     if ($this->frm->isSubmitted()) {
         $this->frm->cleanupFields();
         $fields = $this->frm->getFields();
         // validate fields
         $fields['title']->isFilled(BL::err('TitleIsRequired'));
         if ($this->frm->isCorrect()) {
             // build item
             $item['id'] = BackendContentBlocksModel::getMaximumId() + 1;
             $item['user_id'] = BackendAuthentication::getUser()->getUserId();
             $item['template'] = count($this->templates) > 1 ? $fields['template']->getValue() : $this->templates[0];
             $item['language'] = BL::getWorkingLanguage();
             $item['title'] = $fields['title']->getValue();
             $item['text'] = $fields['text']->getValue();
             $item['hidden'] = $fields['hidden']->getValue() ? 'N' : 'Y';
             $item['status'] = 'active';
             $item['created_on'] = BackendModel::getUTCDate();
             $item['edited_on'] = BackendModel::getUTCDate();
             // insert the item
             $item['revision_id'] = BackendContentBlocksModel::insert($item);
             // trigger event
             BackendModel::triggerEvent($this->getModule(), 'after_add', array('item' => $item));
             // everything is saved, so redirect to the overview
             $this->redirect(BackendModel::createURLForAction('Index') . '&report=added&var=' . urlencode($item['title']) . '&highlight=row-' . $item['id']);
         }
     }
 }
Beispiel #6
0
 /**
  * Validate the form
  */
 private function validateForm()
 {
     if ($this->frm->isSubmitted()) {
         // cleanup the submitted fields, ignore fields that were added by hackers
         $this->frm->cleanupFields();
         // validate fields
         $this->frm->getField('title')->isFilled(BL::err('TitleIsRequired'));
         // no errors?
         if ($this->frm->isCorrect()) {
             // build item
             $item['title'] = $this->frm->getField('title')->getValue();
             $item['language'] = BL::getWorkingLanguage();
             $item['publish_on'] = BackendModel::getUTCDate('Y-m-d H:i:s');
             $item['hidden'] = $this->frm->getField('hidden')->getValue();
             // get the highest sequence available
             $item['sequence'] = BackendGalleryModel::getMaximumCategorySequence() + 1;
             // insert the item
             $item['id'] = BackendGalleryModel::insertCategory($item);
             // trigger event
             BackendModel::triggerEvent($this->getModule(), 'after_add_category', array('item' => $item));
             // everything is saved, so redirect to the overview
             $this->redirect(BackendModel::createURLForAction('categories') . '&report=added-category&var=' . urlencode($item['title']) . '&highlight=row-' . $item['id']);
         }
     }
 }
Beispiel #7
0
 /**
  * Loads the datagrids
  */
 private function loadDataGrids()
 {
     /*
      * DataGrid for the subscriptions that are awaiting moderation.
      */
     $this->dgModeration = new BackendDataGridDB(BackendAgendaModel::QRY_DATAGRID_BROWSE_SUBSCRIPTIONS, array('moderation', BL::getWorkingLanguage()));
     // active tab
     $this->dgModeration->setActiveTab('tabModeration');
     // num items per page
     $this->dgModeration->setPagingLimit(30);
     // header labels
     $this->dgModeration->setHeaderLabels(array('created_on' => \SpoonFilter::ucfirst(BL::lbl('Date'))));
     // add the multi-checkbox column
     $this->dgModeration->setMassActionCheckboxes('checkbox', '[id]');
     // assign column functions
     $this->dgModeration->setColumnFunction(array(new BackendDataGridFunctions(), 'getTimeAgo'), '[created_on]', 'created_on', true);
     // sorting
     $this->dgModeration->setSortingColumns(array('created_on', 'name'), 'created_on');
     $this->dgModeration->setSortParameter('desc');
     // add mass action drop-down
     $ddmMassAction = new \SpoonFormDropdown('action', array('subscribed' => BL::lbl('MoveToSubscribed'), 'delete' => BL::lbl('Delete')), 'subscribed');
     $ddmMassAction->setAttribute('id', 'actionModeration');
     $ddmMassAction->setOptionAttributes('delete', array('data-message-id' => 'confirmDeleteModeration'));
     $ddmMassAction->setOptionAttributes('subscribe', array('data-message-id' => 'confirmSubscribedModeration'));
     $this->dgModeration->setMassAction($ddmMassAction);
     // check if this action is allowed
     if (BackendAuthentication::isAllowedAction('edit_subscription')) {
         $this->dgModeration->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('edit_subscription') . '&amp;id=[id]', BL::lbl('Edit'));
     }
     // check if this action is allowed
     if (BackendAuthentication::isAllowedAction('mass_subscriptions_action')) {
         $this->dgModeration->addColumn('approve', null, BL::lbl('Approve'), BackendModel::createURLForAction('mass_subscriptions_action') . '&amp;id=[id]&amp;from=subscribed&amp;action=subscribed', BL::lbl('Approve'));
     }
     /*
      * DataGrid for the subscriptions that are marked as subscribed
      */
     $this->dgSubscribed = new BackendDataGridDB(BackendAgendaModel::QRY_DATAGRID_BROWSE_SUBSCRIPTIONS, array('subscribed', BL::getWorkingLanguage()));
     // active tab
     $this->dgSubscribed->setActiveTab('tabSubscriptions');
     // num items per page
     $this->dgSubscribed->setPagingLimit(30);
     // header labels
     $this->dgSubscribed->setHeaderLabels(array('created_on' => \SpoonFilter::ucfirst(BL::lbl('Date'))));
     // add the multi-checkbox column
     $this->dgSubscribed->setMassActionCheckboxes('checkbox', '[id]');
     // assign column functions
     $this->dgSubscribed->setColumnFunction(array(new BackendDataGridFunctions(), 'getTimeAgo'), '[created_on]', 'created_on', true);
     // sorting
     $this->dgSubscribed->setSortingColumns(array('created_on', 'name'), 'created_on');
     $this->dgSubscribed->setSortParameter('desc');
     // add mass action drop-down
     $ddmMassAction = new \SpoonFormDropdown('action', array('moderation' => BL::lbl('MoveToModeration'), 'delete' => BL::lbl('Delete')), 'published');
     $ddmMassAction->setAttribute('id', 'actionSubscriptions');
     $ddmMassAction->setOptionAttributes('delete', array('data-message-id' => 'confirmDeleteSubscribed'));
     $this->dgSubscribed->setMassAction($ddmMassAction);
     // check if this action is allowed
     if (BackendAuthentication::isAllowedAction('edit_subscription')) {
         $this->dgSubscribed->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('edit_subscription') . '&amp;id=[id]', BL::lbl('Edit'));
     }
 }
Beispiel #8
0
 /**
  * Execute the action
  */
 public function execute()
 {
     parent::execute();
     // get parameters
     $categoryTitle = trim(\SpoonFilter::getPostValue('value', null, '', 'string'));
     // validate
     if ($categoryTitle === '') {
         $this->output(self::BAD_REQUEST, null, BL::err('TitleIsRequired'));
     } else {
         // get the data
         // build array
         $item['title'] = \SpoonFilter::htmlspecialchars($categoryTitle);
         $item['language'] = BL::getWorkingLanguage();
         $meta['keywords'] = $item['title'];
         $meta['keywords_overwrite'] = 'N';
         $meta['description'] = $item['title'];
         $meta['description_overwrite'] = 'N';
         $meta['title'] = $item['title'];
         $meta['title_overwrite'] = 'N';
         $meta['url'] = BackendBlogModel::getURLForCategory(\SpoonFilter::urlise($item['title']));
         // update
         $item['id'] = BackendBlogModel::insertCategory($item, $meta);
         // output
         $this->output(self::OK, $item, vsprintf(BL::msg('AddedCategory'), array($item['title'])));
     }
 }
 /**
  * Validate the form
  */
 private function validateForm()
 {
     if ($this->frm->isSubmitted()) {
         $this->frm->cleanupFields();
         // validate fields
         $this->meta->validate();
         if ($this->frm->isCorrect()) {
             // build item
             $item['language'] = BL::getWorkingLanguage();
             $item['meta_id'] = $this->meta->save();
             $item['sequence'] = BackendCatalogModel::getMaximumSpecificationSequence() + 1;
             // save the data
             $item['id'] = BackendCatalogModel::insertSpecification($item);
             //--Add the languages
             foreach ((array) BackendModel::get('fork.settings')->get('Core', 'languages') as $key => $language) {
                 $itemLanguage = array();
                 $itemLanguage['id'] = $item['id'];
                 $itemLanguage['language'] = $language;
                 $itemLanguage['title'] = $this->frm->getField('title_' . $language)->getValue();
                 BackendCatalogModel::insertSpecificationLanguage($itemLanguage);
             }
             // trigger event
             BackendModel::triggerEvent($this->getModule(), 'after_add_specification', array('item' => $item));
             // everything is saved, so redirect to the overview
             $this->redirect(BackendModel::createURLForAction('specifications') . '&report=added-specification&var=' . urlencode($this->frm->getField('title_nl')->getValue()) . '&highlight=row-' . $item['id']);
         }
     }
 }
Beispiel #10
0
 /**
  * Validate the form
  */
 protected function validateForm()
 {
     if ($this->frm->isSubmitted()) {
         $this->frm->cleanupFields();
         // validation
         $fields = $this->frm->getFields();
         $fields['name']->isFilled(BL::err('FieldIsRequired'));
         $fields['email']->isFilled(BL::err('FieldIsRequired'));
         $fields['email']->isEmail(BL::err('EmailIsInvalid'));
         if ($this->frm->isCorrect()) {
             $item['name'] = $fields['name']->getValue();
             $item['email'] = $fields['email']->getValue();
             $item['language'] = BL::getWorkingLanguage();
             $item['id'] = BackendMailengineModel::insertUser($item);
             //--Check if there are groups
             if (isset($fields['groups'])) {
                 //--Get all the groups
                 $groups = $fields["groups"]->getValue();
                 foreach ($groups as $key => $value) {
                     $groupUser = array();
                     $groupUser["user_id"] = $item['id'];
                     $groupUser["group_id"] = $value;
                     //--Add user to the group
                     BackendMailengineModel::insertUserToGroup($groupUser);
                 }
             }
             BackendModel::triggerEvent($this->getModule(), 'after_add_user', $item);
             $this->redirect(BackendModel::createURLForAction('users') . '&report=added&highlight=row-' . $item['id']);
         }
     }
 }
Beispiel #11
0
 /**
  * Execute the action
  * We will build the classname, require the class and call the execute method.
  */
 public function execute()
 {
     $this->loadConfig();
     // is the requested action possible? If not we throw an exception.
     // We don't redirect because that could trigger a redirect loop
     if (!in_array($this->getAction(), $this->config->getPossibleActions())) {
         throw new Exception('This is an invalid action (' . $this->getAction() . ').');
     }
     // build action-class
     $actionClass = 'Backend\\Modules\\' . $this->getModule() . '\\Actions\\' . $this->getAction();
     if ($this->getModule() == 'Core') {
         $actionClass = 'Backend\\Core\\Actions\\' . $this->getAction();
     }
     if (!class_exists($actionClass)) {
         throw new Exception('The class ' . $actionClass . ' could not be found.');
     }
     // get working languages
     $languages = Language::getWorkingLanguages();
     $workingLanguages = array();
     // loop languages and build an array that we can assign
     foreach ($languages as $abbreviation => $label) {
         $workingLanguages[] = array('abbr' => $abbreviation, 'label' => $label, 'selected' => $abbreviation == Language::getWorkingLanguage());
     }
     // assign the languages
     $this->tpl->assign('workingLanguages', $workingLanguages);
     // create action-object
     /** @var $object BackendBaseAction */
     $object = new $actionClass($this->getKernel());
     $this->getContainer()->get('logger')->info("Executing backend action '{$object->getAction()}' for module '{$object->getModule()}'.");
     $object->execute();
     return $object->getContent();
 }
Beispiel #12
0
 /**
  * Load the form
  */
 private function loadForm()
 {
     // create form
     $this->frm = new BackendForm('add');
     // fetch the campaigns
     $campaigns = BackendMailmotorModel::getCampaignsAsPairs();
     // fetch the groups
     $groupIds = BackendMailmotorModel::getGroupIDs();
     $groups = BackendMailmotorModel::getGroupsWithRecipientsForCheckboxes();
     // no groups were made yet
     if (empty($groups) && empty($groupIds)) {
         $this->redirect(BackendModel::createURLForAction('AddGroup') . '&error=add-mailing-no-groups');
     } elseif (empty($groups)) {
         // groups were made, but none have subscribers
         $this->redirect(BackendModel::createURLForAction('Addresses') . '&error=no-subscribers');
     }
     // fetch the languages
     $languages = BackendMailmotorModel::getLanguagesForCheckboxes();
     // settings
     $this->frm->addText('name');
     if (count($campaigns) > 1) {
         $this->frm->addDropdown('campaign', $campaigns);
     }
     // sender
     $this->frm->addText('from_name', $this->get('fork.settings')->get($this->getModule(), 'from_name'));
     $this->frm->addText('from_email', $this->get('fork.settings')->get($this->getModule(), 'from_email'));
     // reply-to address
     $this->frm->addText('reply_to_email', $this->get('fork.settings')->get($this->getModule(), 'reply_to_email'));
     // groups - if there is only 1 group present, we select it by default
     $this->frm->addMultiCheckbox('groups', $groups, count($groups) == 1 && isset($groups[0]) ? $groups[0]['value'] : false);
     // languages
     $this->frm->addRadiobutton('languages', $languages, BL::getWorkingLanguage());
 }
 /**
  * Validate the form
  *
  * @return  void
  */
 private function validateForm()
 {
     // is the form submitted?
     if ($this->frm->isSubmitted()) {
         // cleanup the submitted fields, ignore fields that were added by hackers
         $this->frm->cleanupFields();
         // validate fields
         $this->frm->getField('title')->isFilled(BL::err('TitleIsRequired'));
         // validate meta
         $this->meta->validate();
         // no errors?
         if ($this->frm->isCorrect()) {
             // build item
             $item['title'] = $this->frm->getField('title')->getValue();
             $item['language'] = BL::getWorkingLanguage();
             $item['meta_id'] = $this->meta->save();
             $item['sequence'] = BackendSlideshowModel::getMaximumCategorySequence() + 1;
             // insert the item
             $item['id'] = BackendSlideshowModel::insertCategory($item);
             // trigger event
             BackendModel::triggerEvent($this->getModule(), 'after_add_category', array('item' => $item));
             // everything is saved, so redirect to the overview
             $this->redirect(BackendModel::createURLForAction('Categories') . '&report=added-category&var=' . urlencode($item['title']) . '&highlight=' . $item['id']);
         }
     }
 }
Beispiel #14
0
 /**
  * Load the dataGrid
  */
 private function loadDataGrid()
 {
     // filter category
     if ($this->categoryId != null) {
         // create datagrid
         $this->dgProducts = new BackendDataGridDB(BackendCatalogModel::QRY_DATAGRID_BROWSE_FOR_CATEGORY, array($this->categoryId, BL::getWorkingLanguage()));
         // set the URL
         $this->dgProducts->setURL('&amp;category=' . $this->categoryId, true);
     } else {
         // dont filter category
         // create datagrid
         $this->dgProducts = new BackendDataGridDB(BackendCatalogModel::QRY_DATAGRID_BROWSE, array(BL::getWorkingLanguage()));
     }
     // our JS needs to know an id, so we can highlight it
     $this->dgProducts->setRowAttributes(array('id' => 'row-[id]'));
     $this->dgProducts->enableSequenceByDragAndDrop();
     $this->dgProducts->setColumnsHidden(array('category_id', 'sequence'));
     // check if this action is allowed
     if (BackendAuthentication::isAllowedAction('Edit')) {
         // set column URLs
         $this->dgProducts->setColumnURL('title', BackendModel::createURLForAction('edit') . '&amp;id=[id]&amp;category=' . $this->categoryId);
         // add edit and media column
         //$this->dgProducts->addColumn('media', null, BL::lbl('Media'), BackendModel::createURLForAction('media') . '&amp;id=[id]', BL::lbl('Media'));
         $this->dgProducts->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('edit') . '&amp;id=[id]&amp;category=' . $this->categoryId, BL::lbl('Edit'));
         // set media column function
         $this->dgProducts->setColumnFunction(array(__CLASS__, 'setMediaLink'), array('[id]'), 'media');
     }
 }
Beispiel #15
0
 /**
  * Sets the filter based on the $_GET array.
  */
 private function setFilter()
 {
     $this->filter['language'] = $this->getParameter('language', 'array') != '' ? $this->getParameter('language', 'array') : BL::getWorkingLanguage();
     $this->filter['application'] = $this->getParameter('application');
     $this->filter['module'] = $this->getParameter('module');
     $this->filter['type'] = $this->getParameter('type', 'array');
     $this->filter['name'] = $this->getParameter('name');
     $this->filter['value'] = $this->getParameter('value');
     $this->filterQuery = BackendLocaleModel::buildURLQueryByFilter($this->filter);
 }
Beispiel #16
0
 /**
  * Load the datagrids
  */
 private function loadDataGrid()
 {
     $this->dataGrid = new BackendDataGridDB(BackendContentBlocksModel::QRY_BROWSE, array('active', BL::getWorkingLanguage()));
     $this->dataGrid->setSortingColumns(array('title'));
     // check if this action is allowed
     if (BackendAuthentication::isAllowedAction('Edit')) {
         $this->dataGrid->setColumnURL('title', BackendModel::createURLForAction('Edit') . '&amp;id=[id]');
         $this->dataGrid->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('Edit') . '&amp;id=[id]', BL::lbl('Edit'));
     }
 }
 /**
  * Load the dataGrid
  */
 protected function loadDataGrid()
 {
     $this->dataGrid = new DataGridDB(BackendInstagramModel::QRY_DATAGRID_BROWSE, Language::getWorkingLanguage());
     // Reform date
     $this->dataGrid->setColumnFunction(array('Backend\\Core\\Engine\\DataGridFunctions', 'getLongDate'), array('[created_on]'), 'created_on', true);
     // Check if this action is allowed
     if (Authentication::isAllowedAction('Edit')) {
         $this->dataGrid->addColumn('edit', null, Language::lbl('Edit'), Model::createURLForAction('Edit') . '&amp;id=[id]', Language::lbl('Edit'));
         $this->dataGrid->setColumnURL('username', Model::createURLForAction('Edit') . '&amp;id=[id]');
     }
 }
Beispiel #18
0
 /**
  * Load the dataGrid
  */
 private function loadDataGrid()
 {
     $this->dataGrid = new BackendDataGridDB(BackendCatalogModel::QRY_DATAGRID_BROWSE_BRANDS, array(BL::getWorkingLanguage()));
     // check if this action is allowed
     if (BackendAuthentication::isAllowedAction('EditBrand')) {
         $this->dataGrid->setColumnURL('title', BackendModel::createURLForAction('edit_brand') . '&amp;id=[id]');
         $this->dataGrid->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('edit_brand') . '&amp;id=[id]', BL::lbl('Edit'));
     }
     // sequence
     $this->dataGrid->enableSequenceByDragAndDrop();
     $this->dataGrid->setAttributes(array('data-action' => 'SequenceBrands'));
 }
Beispiel #19
0
 /**
  * Load the dataGrid
  */
 private function loadDataGrid()
 {
     $this->dataGrid = new DataGridDB(BackendBlocksModel::QRY_DATAGRID_BROWSE_CATEGORIES, Language::getWorkingLanguage());
     // check if this action is allowed
     if (Authentication::isAllowedAction('EditCategory')) {
         $this->dataGrid->addColumn('edit', null, Language::lbl('Edit'), Model::createURLForAction('EditCategory') . '&amp;id=[id]', Language::lbl('Edit'));
         $this->dataGrid->setColumnURL('title', Model::createURLForAction('EditCategory') . '&amp;id=[id]');
     }
     // sequence
     $this->dataGrid->enableSequenceByDragAndDrop();
     $this->dataGrid->setAttributes(array('data-action' => 'sequence_categories'));
 }
Beispiel #20
0
 /**
  * Load the dataGrid
  */
 protected function loadDataGrid()
 {
     $this->dataGrid = new DataGridDB(BackendBlocksModel::QRY_DATAGRID_BROWSE, Language::getWorkingLanguage());
     // reform date
     $this->dataGrid->setColumnFunction(array('Backend\\Core\\Engine\\DataGridFunctions', 'getLongDate'), array('[created_on]'), 'created_on', true);
     // drag and drop sequencing
     $this->dataGrid->enableSequenceByDragAndDrop();
     // check if this action is allowed
     if (Authentication::isAllowedAction('Edit')) {
         $this->dataGrid->addColumn('edit', null, Language::lbl('Edit'), Model::createURLForAction('Edit') . '&amp;id=[id]', Language::lbl('Edit'));
         $this->dataGrid->setColumnURL('title', Model::createURLForAction('Edit') . '&amp;id=[id]');
     }
 }
 /**
  * Validate the form add image
  *
  * @return void
  */
 private function validateForm()
 {
     //--Check if the add-image form is submitted
     if ($this->frm->isSubmitted()) {
         //--Clean up fields in the form
         $this->frm->cleanupFields();
         //--Get image field
         $filImage = $this->frm->getField('images');
         //--Check if the field is filled in
         if ($filImage->isFilled()) {
             //--Image extension and mime type
             $filImage->isAllowedExtension(array('jpg', 'png', 'gif', 'jpeg'), BL::err('JPGGIFAndPNGOnly'));
             $filImage->isAllowedMimeType(array('image/jpg', 'image/png', 'image/gif', 'image/jpeg'), BL::err('JPGGIFAndPNGOnly'));
             //--Check if there are no errors.
             $strError = $filImage->getErrors();
             if ($strError === null) {
                 //--Get the filename
                 $strFilename = BackendGalleriaModel::checkFilename(substr($filImage->getFilename(), 0, 0 - (strlen($filImage->getExtension()) + 1)), $filImage->getExtension());
                 //--Fill in the item
                 $item = array();
                 $item["album_id"] = (int) $this->id;
                 $item["user_id"] = BackendAuthentication::getUser()->getUserId();
                 $item["language"] = BL::getWorkingLanguage();
                 $item["filename"] = $strFilename;
                 $item["description"] = "";
                 $item["publish_on"] = BackendModel::getUTCDate();
                 $item["hidden"] = "N";
                 $item["sequence"] = BackendGalleriaModel::getMaximumImageSequence($this->id) + 1;
                 //--the image path
                 $imagePath = FRONTEND_FILES_PATH . '/Galleria/Images';
                 //--create folders if needed
                 if (!\SpoonDirectory::exists($imagePath . '/Source')) {
                     \SpoonDirectory::create($imagePath . '/Source');
                 }
                 if (!\SpoonDirectory::exists($imagePath . '/128x128')) {
                     \SpoonDirectory::create($imagePath . '/128x128');
                 }
                 if (!\SpoonDirectory::exists($imagePath . '/800x')) {
                     \SpoonDirectory::create($imagePath . '/800x');
                 }
                 //--image provided?
                 if ($filImage->isFilled()) {
                     //--upload the image & generate thumbnails
                     $filImage->generateThumbnails($imagePath, $item["filename"]);
                 }
                 //--Add item to the database
                 BackendGalleriaModel::insert($item);
             }
         }
     }
 }
 /**
  * Loads the datagrids
  */
 private function loadDataGrid()
 {
     // create datagrid
     $this->dataGrid = new DataGridDB($this->get('team_repository')->getDataGridQuery(), ['language' => Language::getWorkingLanguage()]);
     $this->dataGrid->setColumnFunction(['Rhumsaa\\Uuid\\Uuid', 'fromBytes'], ['[id]'], 'id', true);
     $this->dataGrid->setColumnFunction([new DataGridFunctions(), 'getLongDate'], ['[created_on]'], 'created_on', true);
     // check if this action is allowed
     if (Authentication::isAllowedAction('Edit')) {
         // add column
         $this->dataGrid->addColumn('edit', null, Language::lbl('Edit'), Model::createURLForAction('Edit'), Language::lbl('Edit'));
         $this->dataGrid->setColumnFunction([__CLASS__, 'addIdToEditUrl'], ['[edit]', '[id]'], 'edit', true);
     }
     $this->tpl->assign('dataGrid', (string) $this->dataGrid->getContent());
 }
Beispiel #23
0
 /**
  * Load the datagrids
  */
 private function loadDataGrid()
 {
     $this->dataGrid = new BackendDataGridDB(BackendFormBuilderModel::QRY_BROWSE, BL::getWorkingLanguage());
     $this->dataGrid->setHeaderLabels(array('email' => \SpoonFilter::ucfirst(BL::getLabel('Recipient')), 'sent_forms' => ''));
     $this->dataGrid->setSortingColumns(array('name', 'email', 'method', 'sent_forms'), 'name');
     $this->dataGrid->setColumnFunction(array(new BackendFormBuilderModel(), 'formatRecipients'), array('[email]'), 'email');
     $this->dataGrid->setColumnFunction(array(new BackendFormBuilderModel(), 'getLocale'), array('Method_[method]'), 'method');
     $this->dataGrid->setColumnFunction(array(__CLASS__, 'parseNumForms'), array('[id]', '[sent_forms]'), 'sent_forms');
     // check if edit action is allowed
     if (BackendAuthentication::isAllowedAction('Edit')) {
         $this->dataGrid->setColumnURL('name', BackendModel::createURLForAction('Edit') . '&amp;id=[id]');
         $this->dataGrid->addColumn('edit', null, BL::getLabel('Edit'), BackendModel::createURLForAction('Edit') . '&amp;id=[id]', BL::getLabel('Edit'));
     }
 }
Beispiel #24
0
 /**
  * Checks if a client ID was already set or not
  */
 private function checkForClientID()
 {
     // fetch client ID
     $clientId = BackendMailmotorCMHelper::getClientID();
     // no client ID set, so redirect to settings with an appropriate error message.
     if (empty($clientId)) {
         $this->redirect(BackendModel::createURLForAction('Settings', 'Mailmotor', BL::getWorkingLanguage()));
     }
     // get price per email
     $pricePerEmail = $this->get('fork.settings')->get('Mailmotor', 'price_per_email');
     // check if a price per e-mail is set
     if (empty($pricePerEmail) && $pricePerEmail != 0) {
         $this->redirect(BackendModel::createURLForAction('Settings', 'Mailmotor', BL::getWorkingLanguage()) . '&error=no-price-per-email');
     }
 }
 /**
  * Handles the form
  *
  * @return bool
  */
 public function handle()
 {
     if (!$this->form->isSubmitted() || !$this->isValid()) {
         return false;
     }
     $fields = $this->form->getFields();
     // we already have a teammember? Let's update
     if ($this->teamMember instanceof TeamMember) {
         $this->teamMember->change($this->meta->save(), $fields['name']->getValue(), $fields['description']->getValue());
         return true;
     }
     // time to create a new entity
     $this->teamMember = TeamMember::create($this->meta->save(), Language::getWorkingLanguage(), $fields['name']->getValue(), $fields['description']->getValue());
     return true;
 }
Beispiel #26
0
 /**
  * Loads the datagrids
  */
 private function loadDataGrid()
 {
     // create datagrid
     $this->dataGrid = new BackendDataGridDB(BackendSearchModel::QRY_DATAGRID_BROWSE_SYNONYMS, BL::getWorkingLanguage());
     // sorting columns
     $this->dataGrid->setSortingColumns(array('term'), 'term');
     // column function
     $this->dataGrid->setColumnFunction('str_replace', array(',', ', ', '[synonym]'), 'synonym', true);
     // check if this action is allowed
     if (BackendAuthentication::isAllowedAction('EditSynonym')) {
         // set column URLs
         $this->dataGrid->setColumnURL('term', BackendModel::createURLForAction('EditSynonym') . '&amp;id=[id]');
         // add column
         $this->dataGrid->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('EditSynonym') . '&amp;id=[id]', BL::lbl('Edit'));
     }
 }
Beispiel #27
0
 /**
  * Loads the datagrid
  *
  * @return void
  */
 private function loadDataGrid()
 {
     // create datagrid
     $this->dataGrid = new BackendDataGridDB(BackendGalleryModel::QRY_DATAGRID_CAT, BL::getWorkingLanguage());
     // disable paging
     $this->dataGrid->setPaging(false);
     // set hidden columns
     $this->dataGrid->setColumnsHidden(array('language', 'sequence', 'meta_id', 'id', 'publish_on'));
     // set column URLs
     $this->dataGrid->setColumnURL('title', BackendModel::createURLForAction('edit_category') . '&amp;id=[id]');
     // add edit column
     $this->dataGrid->addColumn('add', null, BL::lbl('Add'), BackendModel::createURLForAction('add_album') . '&amp;id=[id]');
     $this->dataGrid->setHeaderLabels(array('add' => \SpoonFilter::ucfirst(BL::lbl('AddAlbum'))));
     $this->dataGrid->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('edit_category') . '&amp;id=[id]');
     $this->dataGrid->setHeaderLabels(array('edit' => \SpoonFilter::ucfirst(BL::lbl('EditCategory'))));
 }
Beispiel #28
0
 /**
  * Loads the datagrids
  */
 private function loadDataGrid()
 {
     // create datagrid
     $this->dataGrid = new BackendDataGridDB(BackendSearchModel::QRY_DATAGRID_BROWSE_STATISTICS, BL::getWorkingLanguage());
     // hide column
     $this->dataGrid->setColumnsHidden('data');
     // create column
     $this->dataGrid->addColumn('referrer', BL::lbl('Referrer'));
     // header labels
     $this->dataGrid->setHeaderLabels(array('time' => \SpoonFilter::ucfirst(BL::lbl('SearchedOn'))));
     // set column function
     $this->dataGrid->setColumnFunction(array(__CLASS__, 'setReferrer'), '[data]', 'referrer');
     $this->dataGrid->setColumnFunction(array(new BackendDataGridFunctions(), 'getLongDate'), array('[time]'), 'time', true);
     // sorting columns
     $this->dataGrid->setSortingColumns(array('time', 'term'), 'time');
     $this->dataGrid->setSortParameter('desc');
 }
Beispiel #29
0
 /**
  * Load the dataGrid
  */
 protected function loadDataGrid()
 {
     $this->dataGrid = new BackendDataGridDB(BackendAgendaModel::QRY_DATAGRID_BROWSE, BL::getWorkingLanguage());
     // reform date
     $this->dataGrid->setColumnFunction(array(new BackendDataGridFunctions(), 'getLongDate'), array('[begin_date]'), 'begin_date', true);
     // reform date
     $this->dataGrid->setColumnFunction(array(new BackendDataGridFunctions(), 'getLongDate'), array('[end_date]'), 'end_date', true);
     // check if this action is allowed
     if (BackendAuthentication::isAllowedAction('Edit')) {
         //            $this->dataGrid->addColumn('media', null, BL::lbl('Media'),
         //                BackendModel::createURLForAction('media') . '&amp;id=[id]', BL::lbl('Media'));
         //            $this->dataGrid->setColumnFunction(array(__CLASS__, 'setMediaLink'), array('[id]'), 'media');
         //            $this->dataGrid->setColumnAttributes('media', array('style' => 'width: 1%;'));
         $this->dataGrid->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('Edit') . '&amp;id=[id]', BL::lbl('Edit'));
         $this->dataGrid->setColumnURL('title', BackendModel::createURLForAction('Edit') . '&amp;id=[id]');
     }
 }
Beispiel #30
0
 /**
  * Execute the action
  */
 public function execute()
 {
     parent::execute();
     // get parameters
     $itemId = trim(\SpoonFilter::getPostValue('id', null, '', 'int'));
     $lat = \SpoonFilter::getPostValue('lat', null, null, 'float');
     $lng = \SpoonFilter::getPostValue('lng', null, null, 'float');
     // validate id
     if ($itemId == 0) {
         $this->output(self::BAD_REQUEST, null, BL::err('NonExisting'));
     } else {
         //update
         $updateData = array('id' => $itemId, 'lat' => $lat, 'lng' => $lng, 'language' => BL::getWorkingLanguage());
         BackendLocationModel::update($updateData);
         // output
         $this->output(self::OK);
     }
 }