Esempio n. 1
0
 public function main()
 {
     $result = array();
     //init controller data
     $this->extensions->hk_InitData($this, __FUNCTION__);
     //load all commands from languages.
     $term = $this->request->get['term'];
     if (!$term) {
         $this->extensions->hk_UpdateData($this, __FUNCTION__);
         return $this->_no_match();
     }
     $comds_obj = new AdminCommands();
     $this->commands = $comds_obj->commands;
     $result = $comds_obj->getCommands($term);
     $this->extensions->hk_UpdateData($this, __FUNCTION__);
     if (!$result) {
         return $this->_no_match();
     }
     $this->load->library('json');
     $this->response->setOutput(AJson::encode($result));
 }
Esempio n. 2
0
 /**
  * function to get possible commands for the look up
  *
  * @param string $keyword
  * @param string $mode ('total')
  * @return array
  */
 private function _possibleCommands($keyword, $mode = '')
 {
     $comds_obj = new AdminCommands();
     $this->commands = $comds_obj->commands;
     $result = $comds_obj->getCommands($keyword);
     if ($mode == 'total') {
         return count($result['found_actions']);
     }
     $ret = array();
     if ($result['found_actions']) {
         foreach ($result['found_actions'] as $comnd) {
             $ret[] = array('text' => $result['command'] . " " . $comnd['title'] . " " . $result['request'], 'title' => $result['command'] . " " . $comnd['title'] . " " . $result['request'], 'url' => $comnd['url']);
         }
     }
     return $ret;
 }