示例#1
0
 /**
  * get all the domains using an Ajax call
  * @return json array
  */
 public function getdomainsbyajaxAction()
 {
     // Check if it is an ajax request
     if ($this->_request->isXmlHttpRequest()) {
         $theitems = array();
         $item = $this->getRequest()->getParam('search');
         if (!empty($item)) {
             $domains = Domains::findByLikeDomainName($item, "d.domain_id, CONCAT(d.domain, '.', ws.tld) as domain", true);
             if ($domains) {
                 foreach ($domains as $c) {
                     $theitems[$c['domain_id']] = $c['domain'];
                 }
                 if (count($theitems) > 0) {
                     die(json_encode($theitems));
                 } else {
                     die(json_encode($theitems));
                 }
             }
         }
     }
     die;
 }