/**
  * Initiate query invoke command.
  * @return array
  */
 public function invoke($parameters = null)
 {
     $core = $this->core;
     $template = $this->template;
     $navigation = $this->navigation;
     $del_url_ = $navigation->buildURL(false, 'dt=');
     $pagination = $this->factory('pagination');
     $pagination->columns = array(_('Tag Id') => 'tagID', _('Tag Object') => 'tagObject', _('Tag Name') => 'tagName', _('Tag Target') => 'tagTarget', _('Tag Value') => 'tagValue', _('Delete') => '');
     $select_settings = $pagination->query($this->sql);
     $RESULTS['pagination'] = $pagination->navPages();
     $RESULTS['searchForm'] = $pagination->searchForm();
     $RESULTS['th'] = $pagination->th();
     // Icons.
     $delete_icon = $template->icon('cross-script', __('Delete'));
     // OK Loop the array like you would always do.
     foreach ($select_settings as $tag) {
         // Save all the results in $RESULT array.
         $RESULTS['list'][] = array('tagID' => $tag['tagID'], 'tagObject' => tag_field_object($tag['tagObject'], $tag['tagID']), 'tagName' => $tag['tagName'], 'tagTarget' => $tag['tagTarget'], 'tagValue' => $tag['tagValue'], 'delete' => "<a href=\"{$del_url_}{$tag['tagID']}\" {$core->confirmLink(sprintf(__('Are you sure you want to DELETE : %s'), $tag['tagID']))} class=\"button\">" . $delete_icon . "</a>");
     }
     if (!empty($RESULTS['list'])) {
         return $RESULTS;
     } else {
         $RESULTS['list'] = array();
         return $RESULTS;
     }
 }
Example #2
0
 /**
  * Execute Controller
  * @author Jason Schoeman
  */
 public function execute()
 {
     $this->template->heading(__('Tags Manager'));
     $security = $this->security;
     // Action url.
     $self_url_ = $this->navigation->buildURL(false);
     // Should we delete a setting?
     if (!empty($security->get['dt'])) {
         // Lets delete the entry.
         $this->db->deleteQuick('_db_core_tags', 'tagID', $security->get['dt']);
         // Show ok deleted.
         $this->template->ok(sprintf(__('Deleted setting entry %s.'), $security->get['dt']));
     }
     // We have a save action, lets handle it.
     if (!empty($security->post['save'])) {
         $this->db->invokeQuery('PHPDS_updateTagsQuery');
     }
     // Lets create the list of all the entries.
     $RESULTS = $this->db->invokeQuery('PHPDS_readTagsQuery');
     // Load views.
     $view = $this->factory('views');
     // Set Values to Template.
     $view->set('pagination', $RESULTS['pagination']);
     $view->set('searchForm', $RESULTS['searchForm']);
     $view->set('th', $RESULTS['th']);
     $view->set('tagField', tag_field_object());
     $view->set('RESULTS', $RESULTS['list']);
     $view->set('self_url', $self_url_);
     // Call template.
     $view->show();
 }