public function processGetAutoComplete() { $ppo = new CopixPPO(); $datasource = CopixDatasourceFactory::get(CopixRequest::get('datasource'), CopixRequest::asArray()); $datasource->addCondition(CopixRequest::get('field'), 'like', CopixRequest::get('value') . '%'); $results = $datasource->find(); $fieldId = CopixRequest::get('field'); $html = ''; $arMaj = explode(';', CopixRequest::get('tomaj', '')); foreach ($results as $key => $result) { if ($key == CopixRequest::get('nb')) { // break; } $html .= '<li>'; foreach (explode(';', CopixRequest::get('view')) as $field) { if ($fieldId == $field) { $html .= '<span>' . $result->{$field} . '</span> '; } else { if (is_array($arMaj) && in_array($field, $arMaj)) { $html .= '<span class="' . $field . '">' . $result->{$field} . '</span> '; } else { $html .= $result->{$field} . ' '; } } } $html .= '</li>'; } //$ppo->MAIN = '<li><span>taba</span><a class="example-info" target="_blank" title="Dictonary Link" href="http://www.spanishdict.com/AS.cfm?e=taba">[Dict]</a></li><li><span>tabaca</span><a class="example-info" target="_blank" title="Dictonary Link" href="http://www.spanishdict.com/AS.cfm?e=tabaca">[Dict]</a></li><li><span>tabacalera</span><a class="example-info" target="_blank" title="Dictonary Link" href="http://www.spanishdict.com/AS.cfm?e=tabacalera">[Dict]</a></li><li><span>tabacaleras</span><a class="example-info" target="_blank" title="Dictonary Link" href="http://www.spanishdict.com/AS.cfm?e=tabacaleras">[Dict]</a></li><li><span>tabacalero</span><a class="example-info" target="_blank" title="Dictonary Link" href="http://www.spanishdict.com/AS.cfm?e=tabacalero">[Dict]</a></li><li><span>tabacaleros</span><a class="example-info" target="_blank" title="Dictonary Link" href="http://www.spanishdict.com/AS.cfm?e=tabacaleros">[Dict]</a></li><li><span>tabaco</span><a class="example-info" target="_blank" title="Dictonary Link" href="http://www.spanishdict.com/AS.cfm?e=tabaco">[Dict]</a></li><li><span>tabacones</span><a class="example-info" target="_blank" title="Dictonary Link" href="http://www.spanishdict.com/AS.cfm?e=tabacones">[Dict]</a></li><li><span>tabacos</span><a class="example-info" target="_blank" title="Dictonary Link" href="http://www.spanishdict.com/AS.cfm?e=tabacos">[Dict]</a></li><li><span>tabacosa</span><a class="example-info" target="_blank" title="Dictonary Link" href="http://www.spanishdict.com/AS.cfm?e=tabacosa">[Dict]</a></li>'; $ppo->MAIN = $html; //$ppo->HEAD = CopixHTMLHeader::getJSCode(); // $ppo->HEAD = CopixHTMLHeader::get(); return _arDirectPPO($ppo, 'blank.tpl'); }
private function _loadDatasource() { if ($this->_datasource !== null) { return true; } if ($this->getParam('datasource') === null && $this->getParam('dao') !== null) { $this->_params['datasource'] = 'dao'; } if ($this->getParam('datasource') === null) { return false; } $this->_datasourceName = $this->getParam('datasource'); $this->_datasource = CopixDatasourceFactory::get($this->_datasourceName, $this->_params); $this->_mustDoRecord = true; $this->_fillWithDatasourceField(); return true; }
public function getList($pDatasourceName, $pParams) { //CopixLog::log('??? '.$pDatasourceName); $this->_datasourceName = $pDatasourceName; $this->_params = $pParams; $this->_datasource = CopixDatasourceFactory::get($this->_datasourceName, $this->_params); if (isset($pParams['pagerTpl'])) { $this->_pagerTpl = $pParams['pagerTpl']; } //Pour la paging if (isset($pParams['max'])) { $this->_max = $pParams['max']; $this->_paging = true; } //Lien pour accéder à l'édition (fonctionne dans le cas d'un mapping seulement) if (isset($pParams['edit'])) { $this->_editLink = $pParams['edit']; } if (isset($pParams['delete'])) { $this->_delete = $pParams['delete']; } //Ajout de variables pour le template supplémentaire (fonctionne dans le cas d'un tpl externe seulement) //Cette variable contient également (dans le cas d'un appel par un tpl) les variables passées au template d'origine if (isset($pParams['tplvars'])) { $this->_tplvars = $pParams['tplvars']; } //Template externe plutot que mapping if (isset($pParams['tpl'])) { $this->_tpl = $pParams['tpl']; } //Si ni tpl ni mapping alors mapping=all pour prendre tout les champs du datasource if (!isset($pParams['tpl']) && !isset($pParams['mapping'])) { $this->_tplvars['mapping'] = 'all'; } if (isset($pParams['more'])) { $arMore = explode('|', $pParams['more']); if (count($arMore) > 1) { $this->_tplvars['more'] = $arMore[1]; $this->_tplvars['moretitle'] = $arMore[0]; } else { $this->_tplvars['moretitle'] = ''; $this->_tplvars['more'] = $pParams['more']; } } if (isset($pParams['moreLink'])) { $arMore = explode('@', $pParams['moreLink']); $this->_tplvars['moreLink'] = $arMore[1]; $this->_tplvars['moreLinkTitle'] = $arMore[0]; } //Indique si l'on souhaite que la recherche soit lancée au premier affichage //@TODO trouver un nom explicite if (isset($pParams['startupSearch'])) { $this->_startupSearch = $pParams['startupSearch']; } //Pour préciser la classe css du tableau généré (par défaut CopixTable) if (isset($pParams['class'])) { $this->_tplvars['class'] = $pParams['class']; } else { $this->_tplvars['class'] = 'CopixTable'; } //Mapping au format champ=>titre if (isset($pParams['mapping'])) { if (!is_array($pParams['mapping'])) { $pParams['mapping'] = array($pParams['mapping']); } $this->_tplvars['mapping'] = $pParams['mapping']; } $this->_doJavascript(); //Si on demande la recherche au démarrage on lance la génération du tableau if ($this->_startupSearch) { return '<div id="divlist_' . $this->_id . '">' . $this->generateTable() . '</div>'; } return '<div id="divlist_' . $this->_id . '"></div>'; }