public function autocompleteAction() { $term = '%' . $this->getParam('term') . '%'; $exclude = $this->getInt('exclude'); if (!$term) { return null; } $q = new Am_Query($this->getDi()->userTable); $q->addWhere('((t.login LIKE ?) OR (t.email LIKE ?) OR (t.name_f LIKE ?) OR (t.name_l LIKE ?))', $term, $term, $term, $term); if ($exclude) { $q->addWhere('user_id<>?', $exclude); } $q->addWhere('is_affiliate>?', 0); $qq = $q->query(0, 10); $ret = array(); while ($r = $this->getDi()->db->fetchRow($qq)) { $ret[] = array('label' => sprintf('%s / "%s" <%s>', $r['login'], $r['name_f'] . ' ' . $r['name_l'], $r['email']), 'value' => $r['login']); } if ($q->getFoundRows() > 10) { $ret[] = array('label' => sprintf("... %d more rows found ...", $q->getFoundRows() - 10), 'value' => null); } $this->ajaxResponse($ret); }
public function deleteAction() { $this->session->unsetAll(); $this->session->proccessed = 0; $this->session->lastUserId = 0; $query = new Am_Query($this->getDi()->userTable); $this->session->total = $query->getFoundRows(); $this->session->params = array(); $this->session->params['import-id'] = $this->getRequest()->getParam('id'); if (!$this->session->params['import-id']) { throw new Am_Exception_InputError('import-id is undefined'); } $this->sendDelRedirect(); }
protected function deleteProductCategories($demoId) { $query = new Am_Query(new ProductCategoryTable()); $query->add(new Am_Query_Condition_Field('code', 'LIKE', $demoId . ':%')); $count = $query->getFoundRows() ? $query->getFoundRows() : 1; foreach ($query->selectPageRecords(0, $count) as $pCategory) { $pCategory->delete(); } }
public function autocompleteAction() { $term = '%' . $this->getParam('term') . '%'; if (!$term) { return null; } $q = new Am_Query($this->getDi()->userTable); $q->addWhere('(t.login LIKE ?) OR (t.email LIKE ?) OR (t.name_f LIKE ?) OR (t.name_l LIKE ?)', $term, $term, $term, $term); $this->getDi()->hook->call(Am_Event::ADMIN_USERS_AUTOCOMPLETE, array('query' => $q, 'term' => $term)); $qq = $q->query(0, 10); $ret = array(); while ($r = $this->getDi()->db->fetchRow($qq)) { $ret[] = array('label' => sprintf('%s / "%s" <%s>', $r['login'], $r['name_f'] . ' ' . $r['name_l'], $r['email']), 'value' => $r['login']); } if ($q->getFoundRows() > 10) { $ret[] = array('label' => sprintf("... %d more rows found ...", $q->getFoundRows() - 10), 'value' => null); } $this->ajaxResponse($ret); }
public function autocompleteAction() { $term = '%' . $this->getParam('term') . '%'; if (!$term) { return null; } $q = new Am_Query($this->getDi()->couponTable); $q->addWhere('code LIKE ?', $term); $qq = $q->query(0, 10); $ret = array(); $options = $this->getDi()->couponBatchTable->getOptions(); while ($r = $this->getDi()->db->fetchRow($qq)) { $ret[] = array('label' => $r['code'] . ' - ' . $options[$r['batch_id']], 'value' => $r['code']); } if ($q->getFoundRows() > 10) { $ret[] = array('label' => sprintf("... %d more rows found ...", $q->getFoundRows() - 10), 'value' => null); } $this->ajaxResponse($ret); }