Example #1
0
 /**
  * Loads the datagrids
  *
  * @return	void
  */
 private function loadDataGrid()
 {
     // create datagrid
     $this->dataGrid = new BackendDataGridDB(BackendTagsModel::QRY_DATAGRID_BROWSE, BL::getWorkingLanguage());
     // header labels
     $this->dataGrid->setHeaderLabels(array('tag' => ucfirst(BL::lbl('Name')), 'num_tags' => ucfirst(BL::lbl('Amount'))));
     // sorting columns
     $this->dataGrid->setSortingColumns(array('tag', 'num_tags'), 'num_tags');
     $this->dataGrid->setSortParameter('desc');
     // add the multicheckbox column
     $this->dataGrid->setMassActionCheckboxes('checkbox', '[id]');
     // add mass action dropdown
     $ddmMassAction = new SpoonFormDropdown('action', array('delete' => BL::lbl('Delete')), 'delete');
     $ddmMassAction->setOptionAttributes('delete', array('message-id' => 'confirmDelete'));
     $this->dataGrid->setMassAction($ddmMassAction);
     // add column
     $this->dataGrid->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('edit') . '&id=[id]', BL::lbl('Edit'));
     // add attributes, so the inline editing has all the needed data
     $this->dataGrid->setColumnAttributes('tag', array('data-id' => '{id:[id]}'));
 }
Example #2
0
 /**
  * Load the datagrids
  */
 private function loadDataGrid()
 {
     list($query, $parameters) = $this->buildQuery();
     // create datagrid
     $this->dataGrid = new BackendDataGridDB($query, $parameters);
     // overrule default URL
     $this->dataGrid->setURL(BackendModel::createURLForAction(null, null, null, array('offset' => '[offset]', 'order' => '[order]', 'sort' => '[sort]', 'start_date' => $this->filter['start_date'], 'end_date' => $this->filter['end_date']), false) . '&id=' . $this->id);
     // sorting columns
     $this->dataGrid->setSortingColumns(array('sent_on'), 'sent_on');
     $this->dataGrid->setSortParameter('desc');
     // check if this action is allowed
     if (BackendAuthentication::isAllowedAction('DataDetails')) {
         // set colum URLs
         $this->dataGrid->setColumnURL('sent_on', BackendModel::createURLForAction('DataDetails', null, null, array('start_date' => $this->filter['start_date'], 'end_date' => $this->filter['end_date']), false) . '&id=[id]');
         // add edit column
         $this->dataGrid->addColumn('details', null, BL::getLabel('Details'), BackendModel::createURLForAction('DataDetails', null, null, array('start_date' => $this->filter['start_date'], 'end_date' => $this->filter['end_date'])) . '&id=[id]', BL::getLabel('Details'));
     }
     // date
     $this->dataGrid->setColumnFunction(array(new BackendFormBuilderModel(), 'calculateTimeAgo'), '[sent_on]', 'sent_on', false);
     $this->dataGrid->setColumnFunction('ucfirst', '[sent_on]', 'sent_on', false);
     // add the multicheckbox column
     $this->dataGrid->setMassActionCheckboxes('checkbox', '[id]');
     // mass action
     $ddmMassAction = new \SpoonFormDropdown('action', array('delete' => BL::getLabel('Delete')), 'delete');
     $ddmMassAction->setOptionAttributes('delete', array('data-message-id' => 'confirmDelete'));
     $this->dataGrid->setMassAction($ddmMassAction);
 }
Example #3
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') . '&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') . '&id=[id]&from=subscribed&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') . '&id=[id]', BL::lbl('Edit'));
     }
 }
Example #4
0
 /**
  * Load the datagrid
  *
  * @return	void
  */
 private function loadDataGrid()
 {
     // fetch query and parameters
     list($query, $parameters) = $this->buildQuery();
     // create datagrid
     $this->dgProfiles = new BackendDataGridDB($query, $parameters);
     // overrule default URL
     $this->dgProfiles->setURL(BackendModel::createURLForAction(null, null, null, array('offset' => '[offset]', 'order' => '[order]', 'sort' => '[sort]', 'email' => $this->filter['email'], 'status' => $this->filter['status'], 'group' => $this->filter['group']), false));
     // sorting columns
     $this->dgProfiles->setSortingColumns(array('email', 'display_name', 'status', 'registered_on'), 'email');
     // set column URLs
     $this->dgProfiles->setColumnURL('email', BackendModel::createURLForAction('edit') . '&id=[id]');
     // set column function
     $this->dgProfiles->setColumnFunction(array('BackendDataGridFunctions', 'getLongDate'), array('[registered_on]'), 'registered_on', true);
     // add columns
     $this->dgProfiles->addColumn('edit', null, BL::getLabel('Edit'), BackendModel::createURLForAction('edit', null, null, null) . '&id=[id]', BL::getLabel('Edit'));
     // add the mass action controls
     $this->dgProfiles->setMassActionCheckboxes('checkbox', '[id]');
     $ddmMassAction = new SpoonFormDropdown('action', array('addToGroup' => BL::getLabel('AddToGroup'), 'delete' => BL::getLabel('Delete')), 'addToGroup');
     $ddmMassAction->setAttribute('id', 'massAction');
     $ddmMassAction->setOptionAttributes('addToGroup', array('data-message-id' => 'confirmAddToGroup'));
     $ddmMassAction->setOptionAttributes('delete', array('data-message-id' => 'confirmDelete'));
     $this->dgProfiles->setMassAction($ddmMassAction);
 }
Example #5
0
 /**
  * Sets the dropdown for the mass action
  *
  * @param \SpoonFormDropdown $actionDropDown A dropdown-instance.
  */
 public function setMassAction(\SpoonFormDropdown $actionDropDown)
 {
     // build HTML
     $HTML = '<label for="' . $actionDropDown->getAttribute('id') . '">' . \SpoonFilter::ucfirst(BackendLanguage::lbl('WithSelected')) . '</label>' . $actionDropDown->parse() . '<button type="button" class="btn btn-default jsMassActionSubmit">' . '   <span>' . \SpoonFilter::ucfirst(BackendLanguage::lbl('Execute')) . '</span>' . '</button>';
     // assign parsed html
     $this->tpl->assign('massAction', $HTML);
 }
Example #6
0
 /**
  * Loads the datagrids
  */
 private function loadDataGrids()
 {
     /*
      * DataGrid for the published comments.
      */
     $this->dgPublished = new BackendDataGridDB(BackendCatalogModel::QRY_DATAGRID_BROWSE_COMMENTS, array('published', BL::getWorkingLanguage()));
     // active tab
     $this->dgPublished->setActiveTab('tabPublished');
     // num items per page
     $this->dgPublished->setPagingLimit(30);
     // header labels
     $this->dgPublished->setHeaderLabels(array('created_on' => ucfirst(BL::lbl('Date')), 'text' => ucfirst(BL::lbl('Comment'))));
     // add the multicheckbox column
     $this->dgPublished->setMassActionCheckboxes('checkbox', '[id]');
     // assign column functions
     $this->dgPublished->setColumnFunction(array(new BackendDataGridFunctions(), 'getTimeAgo'), '[created_on]', 'created_on', true);
     $this->dgPublished->setColumnFunction(array(new BackendDataGridFunctions(), 'cleanupPlaintext'), '[text]', 'text', true);
     $this->dgPublished->setColumnFunction(array(__CLASS__, 'addProductData'), array('[text]', '[product_title]', '[product_url]', '[id]'), 'text', true);
     // sorting
     $this->dgPublished->setSortingColumns(array('created_on', 'text', 'author'), 'created_on');
     $this->dgPublished->setSortParameter('desc');
     // hide columns
     $this->dgPublished->setColumnsHidden('product_id', 'product_title', 'product_url');
     // add mass action dropdown
     $ddmMassAction = new \SpoonFormDropdown('action', array('moderation' => BL::lbl('MoveToModeration'), 'spam' => BL::lbl('MoveToSpam'), 'delete' => BL::lbl('Delete')), 'spam');
     $ddmMassAction->setAttribute('id', 'actionPublished');
     $ddmMassAction->setOptionAttributes('delete', array('data-message-id' => 'confirmDeletePublished'));
     $ddmMassAction->setOptionAttributes('spam', array('data-message-id' => 'confirmSpamPublished'));
     $this->dgPublished->setMassAction($ddmMassAction);
     // check if this action is allowed
     if (BackendAuthentication::isAllowedAction('EditComment')) {
         $this->dgPublished->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('edit_comment') . '&amp;id=[id]', BL::lbl('Edit'));
     }
     // check if this action is allowed
     if (BackendAuthentication::isAllowedAction('MassCommentAction')) {
         $this->dgPublished->addColumn('mark_as_spam', null, BL::lbl('MarkAsSpam'), BackendModel::createURLForAction('mass_comment_action') . '&amp;id=[id]&amp;from=published&amp;action=spam', BL::lbl('MarkAsSpam'));
     }
     /*
      * DataGrid for the comments that are awaiting moderation.
      */
     $this->dgModeration = new BackendDataGridDB(BackendCatalogModel::QRY_DATAGRID_BROWSE_COMMENTS, 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' => ucfirst(BL::lbl('Date')), 'text' => ucfirst(BL::lbl('Comment'))));
     // add the multicheckbox column
     $this->dgModeration->setMassActionCheckboxes('checkbox', '[id]');
     // assign column functions
     $this->dgModeration->setColumnFunction(array(new BackendDataGridFunctions(), 'getTimeAgo'), '[created_on]', 'created_on', true);
     $this->dgModeration->setColumnFunction(array(new BackendDataGridFunctions(), 'cleanupPlaintext'), '[text]', 'text', true);
     $this->dgModeration->setColumnFunction(array(__CLASS__, 'addProductData'), array('[text]', '[product_title]', '[product_url]', '[id]'), 'text', true);
     // sorting
     $this->dgModeration->setSortingColumns(array('created_on', 'text', 'author'), 'created_on');
     $this->dgModeration->setSortParameter('desc');
     // hide columns
     $this->dgModeration->setColumnsHidden('product_id', 'product_title', 'product_url');
     // add mass action dropdown
     $ddmMassAction = new \SpoonFormDropdown('action', array('published' => BL::lbl('MoveToPublished'), 'spam' => BL::lbl('MoveToSpam'), 'delete' => BL::lbl('Delete')), 'published');
     $ddmMassAction->setAttribute('id', 'actionModeration');
     $ddmMassAction->setOptionAttributes('delete', array('data-message-id' => 'confirmDeleteModeration'));
     $ddmMassAction->setOptionAttributes('spam', array('data-message-id' => 'confirmSpamModeration'));
     $this->dgModeration->setMassAction($ddmMassAction);
     // check if this action is allowed
     if (BackendAuthentication::isAllowedAction('EditComment')) {
         $this->dgModeration->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('edit_comment') . '&amp;id=[id]', BL::lbl('Edit'));
     }
     // check if this action is allowed
     if (BackendAuthentication::isAllowedAction('MassCommentAction')) {
         $this->dgModeration->addColumn('approve', null, BL::lbl('Approve'), BackendModel::createURLForAction('mass_comment_action') . '&amp;id=[id]&amp;from=published&amp;action=published', BL::lbl('Approve'));
     }
     /*
      * DataGrid for the comments that are marked as spam
      */
     $this->dgSpam = new BackendDataGridDB(BackendCatalogModel::QRY_DATAGRID_BROWSE_COMMENTS, array('spam', BL::getWorkingLanguage()));
     // active tab
     $this->dgSpam->setActiveTab('tabSpam');
     // num items per page
     $this->dgSpam->setPagingLimit(30);
     // header labels
     $this->dgSpam->setHeaderLabels(array('created_on' => ucfirst(BL::lbl('Date')), 'text' => ucfirst(BL::lbl('Comment'))));
     // add the multicheckbox column
     $this->dgSpam->setMassActionCheckboxes('checkbox', '[id]');
     // assign column functions
     $this->dgSpam->setColumnFunction(array(new BackendDataGridFunctions(), 'getTimeAgo'), '[created_on]', 'created_on', true);
     $this->dgSpam->setColumnFunction(array(new BackendDataGridFunctions(), 'cleanupPlaintext'), '[text]', 'text', true);
     $this->dgSpam->setColumnFunction(array(__CLASS__, 'addProductData'), array('[text]', '[product_title]', '[product_url]', '[id]'), 'text', true);
     // sorting
     $this->dgSpam->setSortingColumns(array('created_on', 'text', 'author'), 'created_on');
     $this->dgSpam->setSortParameter('desc');
     // hide columns
     $this->dgSpam->setColumnsHidden('product_id', 'product_title', 'product_url');
     // add mass action dropdown
     $ddmMassAction = new \SpoonFormDropdown('action', array('published' => BL::lbl('MoveToPublished'), 'moderation' => BL::lbl('MoveToModeration'), 'delete' => BL::lbl('Delete')), 'published');
     $ddmMassAction->setAttribute('id', 'actionSpam');
     $ddmMassAction->setOptionAttributes('delete', array('data-message-id' => 'confirmDeleteSpam'));
     $this->dgSpam->setMassAction($ddmMassAction);
     // check if this action is allowed
     if (BackendAuthentication::isAllowedAction('MassCommentAction')) {
         $this->dgSpam->addColumn('approve', null, BL::lbl('Approve'), BackendModel::createURLForAction('mass_comment_action') . '&amp;id=[id]&amp;from=spam&amp;action=published', BL::lbl('Approve'));
     }
 }
Example #7
0
    /**
     * Sets the dropdown for the mass action
     *
     * @param SpoonFormDropdown $actionDropDown A dropdown-instance.
     */
    public function setMassAction(SpoonFormDropdown $actionDropDown)
    {
        // buid HTML
        $HTML = '<p><label for="' . $actionDropDown->getAttribute('id') . '">' . SpoonFilter::ucfirst(BL::lbl('WithSelected')) . '</label></p>
				<p>
					' . $actionDropDown->parse() . '
				</p>
				<div class="buttonHolder">
					<a href="#" class="submitButton button">
						<span>' . SpoonFilter::ucfirst(BL::lbl('Execute')) . '</span>
					</a>
				</div>';
        // assign parsed html
        $this->tpl->assign('massAction', $HTML);
    }
Example #8
0
 /**
  * Loads the datagrids
  */
 private function loadDataGrids()
 {
     /*
      * DataGrid for the orders that are awaiting moderation.
      */
     $this->dgModeration = new BackendDataGridDB(BackendCatalogModel::QRY_DATAGRID_BROWSE_ORDERS, array('moderation'));
     // active tab
     $this->dgModeration->setActiveTab('tabModeration');
     // num items per page
     $this->dgModeration->setPagingLimit(30);
     // header labels
     $this->dgModeration->setHeaderLabels(array('ordered_on' => ucfirst(BL::lbl('Date'))));
     // add the multicheckbox column
     $this->dgModeration->setMassActionCheckboxes('checkbox', '[id]');
     // assign column functions
     $this->dgModeration->setColumnFunction(array(new BackendDataGridFunctions(), 'getTimeAgo'), '[ordered_on]', 'ordered_on', true);
     // sorting
     $this->dgModeration->setSortingColumns(array('ordered_on', 'order_nr'), 'ordered_on');
     $this->dgModeration->setSortParameter('desc');
     // hide columns
     $this->dgModeration->setColumnsHidden('status');
     // add mass action dropdown
     $ddmMassAction = new \SpoonFormDropdown('action', array('completed' => BL::lbl('MoveToCompleted'), 'delete' => BL::lbl('Delete')), 'completed');
     $ddmMassAction->setAttribute('id', 'actionModeration');
     $ddmMassAction->setOptionAttributes('delete', array('data-message-id' => 'confirmDeleteModeration'));
     $ddmMassAction->setOptionAttributes('completed', array('data-message-id' => 'confirmCompletedModeration'));
     $this->dgModeration->setMassAction($ddmMassAction);
     // check if this action is allowed
     if (BackendAuthentication::isAllowedAction('EditOrder')) {
         $this->dgModeration->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('edit_order') . '&amp;id=[id]', BL::lbl('Edit'));
     }
     // check if this action is allowed
     if (BackendAuthentication::isAllowedAction('MassOrderAction')) {
         $this->dgModeration->addColumn('approve', null, BL::lbl('Approve'), BackendModel::createURLForAction('mass_order_action') . '&amp;id=[id]&amp;from=moderation&amp;action=completed', BL::lbl('Approve'));
     }
     /*
      * DataGrid for the orders that are marked as completed
      */
     $this->dgCompleted = new BackendDataGridDB(BackendCatalogModel::QRY_DATAGRID_BROWSE_ORDERS, array('completed'));
     // active tab
     $this->dgCompleted->setActiveTab('tabCompleted');
     // num items per page
     $this->dgCompleted->setPagingLimit(30);
     // header labels
     $this->dgCompleted->setHeaderLabels(array('ordered_on' => ucfirst(BL::lbl('Date'))));
     // add the multicheckbox column
     $this->dgCompleted->setMassActionCheckboxes('checkbox', '[id]');
     // assign column functions
     $this->dgCompleted->setColumnFunction(array(new BackendDataGridFunctions(), 'getTimeAgo'), '[ordered_on]', 'ordered_on', true);
     // sorting
     $this->dgCompleted->setSortingColumns(array('ordered_on'), 'ordered_on');
     $this->dgCompleted->setSortParameter('desc');
     // hide columns
     $this->dgCompleted->setColumnsHidden('status');
     // add mass action dropdown
     $ddmMassAction = new \SpoonFormDropdown('action', array('moderation' => BL::lbl('MoveToModeration'), 'delete' => BL::lbl('Delete')), 'moderation');
     $ddmMassAction->setAttribute('id', 'actionCompleted');
     $ddmMassAction->setOptionAttributes('delete', array('data-message-id' => 'confirmDeleteCompleted'));
     $this->dgCompleted->setMassAction($ddmMassAction);
 }
 /**
  * Loads the datagrid
  *
  * @return  void
  */
 private function loadDataGrid()
 {
     // create datagrid
     $this->dataGrid = new BackendDataGridDB(BackendSlideshowModel::QRY_DATAGRID_BROWSE_IMAGES, array($this->id));
     // add mass checkboxes
     $this->dataGrid->setMassActionCheckboxes('checkbox', '[id]');
     // disable paging
     $this->dataGrid->setPaging(false);
     // create a thumbnail preview
     $this->dataGrid->addColumn('preview', 'Preview');
     $this->dataGrid->setColumnFunction(array('Backend\\Modules\\Slideshow\\Engine\\Model', 'getPreview'), '[filename]', 'preview', true);
     // enable drag and drop
     $this->dataGrid->enableSequenceByDragAndDrop();
     // our JS needs to know an id, so we can send the new order
     $this->dataGrid->setRowAttributes(array('id' => '[id]'));
     $this->dataGrid->setAttributes(array('data-action' => "ImageSequence"));
     // hide
     $this->dataGrid->setColumnHidden('filename');
     // add edit column
     $this->dataGrid->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('EditImage') . '&amp;id=[id]&amp;galleryid=' . $this->id, BL::lbl('Edit'));
     // set column order
     $this->dataGrid->setColumnsSequence('dragAndDropHandle', 'checkbox', 'preview', 'hidden', 'caption', 'edit');
     // add mass action dropdown
     $ddmMassAction = new \SpoonFormDropdown('action', array('delete' => BL::getLabel('Delete'), 'hide' => BL::getLabel('Hide'), 'publish' => BL::getLabel('Publish')), 'delete');
     $ddmMassAction->setAttribute('id', 'actionDeleted');
     $this->dataGrid->setMassAction($ddmMassAction);
     $this->frm->add($ddmMassAction);
 }