|
@@ -190,30 +190,64 @@ Action::register('navigation_widget_configure',function(&$response){
|
|
|
exit;
|
|
|
});
|
|
|
|
|
|
-Action::register('navigation_widget_configure_autocomplete',function(&$response){
|
|
|
- global $myUser,$_;
|
|
|
- User::check_access('navigation','read');
|
|
|
- require_once(__DIR__.SLASH.'MenuItem.class.php');
|
|
|
- if(!$myUser->connected()) throw new Exception("Vous devez être connecté",401);
|
|
|
- if(empty($_['keyword'])) return;
|
|
|
-
|
|
|
- $rows = array();
|
|
|
- foreach(MenuItem::staticQuery('SELECT item.* FROM {{table}} item LEFT JOIN {{table}} menu ON item.menu=menu.id WHERE item.label LIKE ? AND item.menu!=? AND menu.user=?',array('%'.$_['keyword'].'%',0,$myUser->login),true) as $menu){
|
|
|
- $row = $menu->toArray();
|
|
|
- $row['name'] = $row['label'];
|
|
|
- $rows[] = $row;
|
|
|
- }
|
|
|
|
|
|
- Plugin::callHook("menu_main", array(&$pages));
|
|
|
|
|
|
- foreach($pages as $page){
|
|
|
- if( strpos(slugify($page['label']), slugify($_["keyword"])) === false ) continue;
|
|
|
- $icon = isset($page['icon'])? $page['icon'] : 'far fa-bookmark';
|
|
|
- $row = $page;
|
|
|
- $row['name'] = $page['label'];
|
|
|
- $rows[] = $row;
|
|
|
- }
|
|
|
|
|
|
- usort ($rows , function($a,$b){return $a['sort']>$b['sort']?-1:1;});
|
|
|
- $response['rows'] = $rows;
|
|
|
-});
|
|
|
+ Action::register('page_autocomplete',function(&$response){
|
|
|
+ global $myUser,$_,$myFirm;
|
|
|
+
|
|
|
+
|
|
|
+ User::check_access('navigation','read');
|
|
|
+ require_once(__DIR__.SLASH.'MenuItem.class.php');
|
|
|
+ if(!$myUser->connected()) throw new Exception("Vous devez être connecté",401);
|
|
|
+ if(empty($_['keyword'])) return;
|
|
|
+
|
|
|
+ $rows = array();
|
|
|
+ foreach(MenuItem::staticQuery('SELECT item.* FROM {{table}} item LEFT JOIN {{table}} menu ON item.menu=menu.id WHERE item.label LIKE ? AND item.menu!=? AND menu.user=?',array('%'.$_['keyword'].'%',0,$myUser->login),true) as $menu){
|
|
|
+ $row = $menu->toArray();
|
|
|
+ $rows[] = $row;
|
|
|
+ }
|
|
|
+
|
|
|
+ Plugin::callHook("menu_main", array(&$pages));
|
|
|
+
|
|
|
+ foreach($pages as $page){
|
|
|
+ if( strpos(slugify($page['label']), slugify($_["keyword"])) === false ) continue;
|
|
|
+ $icon = isset($page['icon'])? $page['icon'] : 'far fa-bookmark';
|
|
|
+ $row = $page;
|
|
|
+ $row['label'] = $page['label'];
|
|
|
+ $rows[] = $row;
|
|
|
+ }
|
|
|
+
|
|
|
+ usort ($rows , function($a,$b){return $a['sort']>$b['sort']?-1:1;});
|
|
|
+ $response['rows'] = $rows;
|
|
|
+
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ Action::register('page_by_uid',function(&$response){
|
|
|
+ global $myUser,$_;
|
|
|
+ if (!$myUser->connected()) throw new Exception("Vous devez être connecté",401);
|
|
|
+ require_once(__DIR__.SLASH.'MenuItem.class.php');
|
|
|
+
|
|
|
+ $response['items'] = array();
|
|
|
+ //@TODO
|
|
|
+ // $query = 'SELECT item.* FROM {{table}} item WHERE item.label LIKE ? AND item.menu!=? AND menu.user=? IN(';
|
|
|
+ // $query .= implode(',', array_fill(0, count($_['items']), '?'));
|
|
|
+ // $query .= ')';
|
|
|
+
|
|
|
+
|
|
|
+ // foreach(MenuItem::staticQuery($query,$_['items'],true) as $client) {
|
|
|
+
|
|
|
+ // $row = $client->toArray();
|
|
|
+ // unset($row['parent']);
|
|
|
+ // if(!empty($client->foreign('parentLabel'))) $row['parent'] = array('label'=>$client->foreign('parentLabel'));
|
|
|
+ // $row['label'] = html_entity_decode($row['label'], ENT_QUOTES);
|
|
|
+ // if(!empty($row['pseudonym'])) $row['label'].= ' ('.html_entity_decode($row['pseudonym'], ENT_QUOTES).')' ;
|
|
|
+ // $response['items'][$row['id']] = $row;
|
|
|
+ // }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ });
|