示例#1
0
 /**
  * @return mixed
  */
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $c->select($this->modx->getSelectColumns('modManagerLog', 'modManagerLog', '', array('action'), true));
     //        $c->select($this->modx->getSelectColumns('modManagerLog','modManagerLog'));
     $c->select(array('User.username', 'Template.templatename', 'Chunk.name as chunkname', 'Snippet.name as snippetname', 'Plugin.name as pluginname', 'TV.name as tvname'));
     $c->innerJoin('modUser', 'User');
     $c->leftJoin('modTemplate', 'Template', '`modManagerLog`.item = `Template`.`id` AND `modManagerLog`.`classKey` = "modTemplate"');
     $c->leftJoin('modChunk', 'Chunk', '`modManagerLog`.item = `Chunk`.`id` AND `modManagerLog`.`classKey` = "modChunk"');
     $c->leftJoin('modSnippet', 'Snippet', '`modManagerLog`.item = `Snippet`.`id` AND `modManagerLog`.`classKey` = "modSnippet"');
     $c->leftJoin('modPlugin', 'Plugin', '`modManagerLog`.item = `Plugin`.`id` AND `modManagerLog`.`classKey` = "modPlugin"');
     $c->leftJoin('modTemplateVar', 'TV', '`modManagerLog`.item = `TV`.`id` AND `modManagerLog`.`classKey` = "modTemplateVar"');
     $query = trim($this->getProperty('query'));
     if ($query) {
         $c->where('(Template.templatename LIKE "%' . $query . '%" OR Chunk.name LIKE "%' . $query . '%" OR Snippet.name LIKE "%' . $query . '%" OR Plugin.name LIKE "%' . $query . '%" OR TV.name LIKE "%' . $query . '%")');
     } else {
         $c->where('(modManagerLog.action LIKE "template_%" OR modManagerLog.action LIKE "chunk_%" OR modManagerLog.action LIKE "snippet_%" OR modManagerLog.action LIKE "plugin_%" OR modManagerLog.action LIKE "tv_%")');
     }
     $user = intval($this->getProperty('user'));
     if ($user) {
         $c->andCondition(array('modManagerLog.user' => $user));
     }
     $dateStart = trim($this->getProperty('datestart'));
     if ($dateStart) {
         $dateStart = date('Y-m-d', strtotime($dateStart));
         $c->andCondition(array('modManagerLog.occurred:>=' => $dateStart));
     }
     $dateEnd = trim($this->getProperty('dateend'));
     if ($dateEnd) {
         $dateEnd = date('Y-m-d 23:59:59', strtotime($dateEnd));
         $c->andCondition(array('modManagerLog.occurred:<=' => $dateEnd));
     }
     return $c;
 }
示例#2
0
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $contextKey = $this->getProperty('cntx');
     if (!empty($contextKey)) {
         $c->andCondition(array('context_key' => $contextKey));
     }
     $query = $this->getProperty('query');
     if (!empty($query)) {
         $c->andCondition(array('id' => $query, 'OR:pagetitle:LIKE' => '%' . $query . '%'));
     }
     return $c;
 }
示例#3
0
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $query = $this->getProperty('query');
     if (!empty($query)) {
         $c->andCondition(array('pattern:LIKE' => '%' . $query . '%', 'OR:target:LIKE' => '%' . $query . '%'));
     }
     $context = $this->getProperty('context');
     if (!empty($context)) {
         $c->andCondition(array('context_key:LIKE' => '%' . $context . '%'));
     }
     return $c;
 }
示例#4
0
 /**
  * @return mixed
  */
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $c->leftJoin('modUser', 'UserCreate');
     $c->select('adminNotes.*, UserCreate.username');
     $where = '(adminNotes.private = 0 OR adminNotes.private = 1 AND adminNotes.createdby = ' . $this->modx->user->get('id') . ')';
     $query = trim($this->getProperty('searchQuery'));
     $wheresearch = trim($this->getProperty('wheresearch'));
     if ($query) {
         switch ($wheresearch) {
             case 1:
             case '':
                 $where .= ' AND (adminNotes.title LIKE "%' . $query . '%" OR adminNotes.text LIKE "%' . $query . '%"  OR FIND_IN_SET(\'' . $query . '\', `tags`))';
                 break;
             case 2:
                 $where .= ' AND adminNotes.title LIKE "%' . $query . '%"';
                 break;
             case 3:
                 $where .= ' AND adminNotes.text LIKE "%' . $query . '%"';
                 break;
             case 4:
                 $where .= " AND FIND_IN_SET('{$query}', `tags`)";
                 break;
         }
     }
     $c->where($where);
     $private = $this->getProperty('private');
     if ($private) {
         $c->andCondition(array('adminNotes.createdby' => $this->modx->user->id));
     }
     return $c;
 }
 /**
  * Filter on status and add task data
  *
  * @param xPDOQuery $c
  * @return xPDOQuery
  */
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $c->innerJoin('sTask', 'Task');
     $c->select($this->modx->getSelectColumns($this->classKey, $this->classKey));
     $c->select($this->modx->getSelectColumns('sTask', 'Task', 'task_'));
     $c->where($this->additionalWhere);
     $query = $this->getProperty('query');
     if (!empty($query)) {
         $c->andCondition(array('Task.reference:LIKE' => '%' . $query . '%'));
     }
     $namespace = $this->getProperty('namespace');
     if (!empty($namespace)) {
         $c->andCondition(array('Task.namespace' => $namespace));
     }
     return $c;
 }
示例#6
0
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $query = trim($this->getProperty('query'));
     if ($query !== '') {
         $c->andCondition(array('conversation:LIKE' => "%{$query}%"));
     }
     return $c;
 }
示例#7
0
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $form = $this->getProperty('formId');
     $startDate = $this->getProperty('startDate');
     $endDate = $this->getProperty('endDate');
     if (!empty($form)) {
         $c->where(array('form_id' => $form));
     }
     if (!empty($startDate)) {
         $c->andCondition(array('senton:>' => date('Y-m-d', strtotime($startDate)) . ' 00:00:00'));
     }
     if (!empty($endDate)) {
         $c->andCondition(array('senton:<' => date('Y-m-d', strtotime($endDate)) . ' 23:59:59'));
     }
     //        var_dump($form, date('Y-m-d H:i:s', strtotime($startDate)), date('Y-m-d H:i:s', strtotime($endDate))); die;
     return $c;
 }
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $query = $this->getProperty('query');
     if (!empty($query)) {
         $c->andCondition(array('id' => $query, 'OR:name:LIKE' => '%' . $query . '%'));
     }
     return $c;
 }
示例#9
0
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $c->where(array('key:!=' => 'mgr'));
     $query = $this->getProperty('query');
     if (!empty($query)) {
         $c->andCondition(array('key:LIKE' => '%' . $query . '%'));
     }
     return $c;
 }
示例#10
0
 /**
  * Can be used to adjust the query prior to the COUNT statement
  *
  * @param xPDOQuery $c
  * @return xPDOQuery
  */
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $query = $this->getProperty('query');
     if (!empty($query)) {
         $c->andCondition(array('modResource.pagetitle:LIKE' => '%' . $query . '%', 'OR:modResource.longtitle:LIKE' => '%' . $query . '%', 'OR:modResource.menutitle:LIKE' => '%' . $query . '%', 'OR:modResource.description:LIKE' => '%' . $query . '%'));
     }
     $c->where(array('class_key:=' => 'GridContainer', 'OR:class_key:=' => 'StaticGridContainer'));
     return $c;
 }
示例#11
0
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $c->innerJoin('modUser', 'Sender');
     $c->where(array('recipient' => $this->modx->user->get('id')));
     $search = $this->getProperty('search', '');
     if (!empty($search)) {
         $c->andCondition(array('subject:LIKE' => '%' . $search . '%', 'OR:message:LIKE' => '%' . $search . '%'), null, 2);
     }
     return $c;
 }
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $c->select(array('qsbButton.*', 'Icon.class AS iconcls', 'Icon.path as iconpath'));
     $c->leftJoin('qsbIcon', 'Icon');
     $c->where(array('set' => $this->getProperty('id')));
     $query = $this->getProperty('query');
     if (!empty($query)) {
         $c->andCondition(array('id' => $query, 'OR:text:LIKE' => '%' . $query . '%'));
     }
     return $c;
 }
示例#13
0
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $form = $this->getProperty('form');
     if (!empty($form)) {
         $c->where(array('form' => $form));
     }
     $context_key = $this->getProperty('context_key');
     if (!empty($context_key)) {
         $c->where(array('context_key' => $context_key));
     }
     $startDate = $this->getProperty('startDate');
     if ($startDate != '') {
         $c->andCondition(array('date:>' => strtotime($startDate . ' 00:00:00')));
     }
     $endDate = $this->getProperty('endDate');
     if ($endDate != '') {
         $c->andCondition(array('date:<' => strtotime($endDate . ' 23:59:59')));
     }
     return $c;
 }
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $selected = $this->getProperty('selected');
     if (!empty($selected)) {
         $newSort = 'FIELD(id, ' . $selected . ') DESC, ' . $this->defaultSortField;
         $this->setProperty('sort', $newSort);
     }
     $query = $this->getProperty('query');
     if (!empty($query)) {
         $c->andCondition(array('name:LIKE' => '%' . $query . '%', 'OR:class:LIKE' => '%' . $query . '%'));
     }
     return $c;
 }
 /**
  * Only load variations for current test.
  *
  * @param xPDOQuery $c
  * @return xPDOQuery
  */
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $c->select($this->modx->getSelectColumns($this->classKey, $this->classKey));
     // search
     $query = $this->getProperty('query');
     if (!empty($query)) {
         $c->andCondition(array('reference:LIKE' => '%' . $query . '%', 'OR:description:LIKE' => '%' . $query . '%', 'OR:namespace:LIKE' => '%' . $query . '%'));
     }
     // filter on class key
     $classKey = $this->getProperty('class_key');
     if (!empty($classKey)) {
         $c->andCondition(array('class_key' => $classKey));
     }
     // implement runs
     $subc = $this->modx->newQuery('sTaskRun');
     $subc->select($this->modx->getSelectColumns('sTaskRun', 'sTaskRun', '', array('timing')));
     $subc->where(array('status' => sTaskRun::STATUS_SCHEDULED, '`sTaskRun`.`task` = `sTask`.`id`'));
     $subc->sortby('timing', 'asc');
     $subc->limit(1);
     $subc->prepare();
     $c->select('(' . $subc->toSQL() . ') AS next_run');
     return $c;
 }
示例#16
0
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $where = array();
     if ($res = $this->getProperty('res')) {
         $where['res'] = $res;
     }
     $where['Language.active'] = 1;
     if ($ctx = $this->getProperty('context')) {
         $c->leftJoin('XlexiconLanguage', 'Language', "Language.iso_code = {$this->classKey}.language");
         $c->andCondition(array('Language.context:REGEXP' => "(^|.+,){$ctx}(,.+|\$)"));
     }
     $c->where($where);
     return $c;
 }
示例#17
0
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $cronid = $this->getProperty('cronid');
     if (!empty($cronid)) {
         $c->where(array('cronjob' => $cronid));
     }
     $error = $this->getProperty('error', 'all');
     if ($error != 'all') {
         $c->where(array('error' => $error));
     }
     $query = $this->getProperty('query');
     if (!empty($query)) {
         $c->andCondition(array('message:LIKE' => '%' . $query . '%'));
     }
     return $c;
 }
示例#18
0
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $ugns = $this->modx->user->getUserGroupNames();
     $userGroupNames = '';
     foreach ($ugns as $ugn) {
         $userGroupNames .= '"' . $ugn . '",';
     }
     $userGroupNames = rtrim($userGroupNames, ',');
     $c->leftJoin('modUser', 'Author');
     $c->leftJoin('modResource', 'Resource');
     $c->innerJoin('quipThread', 'Thread');
     $c->where(array('quipComment.deleted' => $this->getProperty('deleted', false), 'quipComment.approved' => false));
     /* handle moderator permissions */
     $c->andCondition(array('(
         Thread.moderated = 0
             OR Thread.moderator_group IN (' . $userGroupNames . ')
             OR "' . $this->modx->user->get('username') . '" IN (Thread.moderators)
     )'));
     $thread = $this->getProperty('thread');
     if (!empty($thread)) {
         $c->where(array('quipComment.thread' => $thread));
     }
     return $c;
 }