예제 #1
0
 public function displayItem($ID, $itemtype)
 {
     global $LANG, $CFG_GLPI, $ID;
     $welcome = " ";
     if (class_exists($itemtype)) {
         $classname = ucfirst($itemtype);
         $obj = new $classname();
         $welcome = $obj->getTypeName() . " (" . $_REQUEST['id'] . ")";
     }
     $table = $obj->getTable();
     //saveActiveProfileAndApplyRead();
     $common = new PluginMobileCommon();
     $common->displayHeader($welcome, "search.php?menu=" . $_GET['menu'] . "&ssmenu=" . $_GET['ssmenu'] . "&itemtype={$itemtype}", '', '', 'item');
     echo "<form action='" . $CFG_GLPI["root_doc"] . "/plugins/mobile/front/item.form.php?menu=" . $_GET['menu'] . "&ssmenu=" . $_GET['ssmenu'] . "&itemtype={$itemtype}&id={$ID}" . "' method='post'>";
     if (largeScreen() && DISPLAYLEFTPANEL) {
         //if (true) {
         //if (false) {
         /*ob_start();
                  $obj->showForm($ID);  
                  $out = ob_get_contents();      
                  ob_end_clean();
                  
                  //delete script         
                  $out = preg_replace('/((<[\s\/]*script\b[^>]*>)([^>]*)(<\/script>))/i', '', $out);
                  
                  //hide tooltips
                  $out = preg_replace('/(<a id=\'tooltip[^>])(.*?)(<\/a>)/', '', $out);
                  $out = preg_replace('/(<img id=\'tooltip[^>])(.*?)(>)/', '', $out);
                  
                  //parse menu navigate
                  $out = preg_replace('/(<a)(.*?)(search\.php[^>])(.*?)(<\/a>&nbsp;\:)/', '', $out);      
                  $out = preg_replace('/(item\.php\?id=[0-9]*)/', '$0'."&menu=".$_GET['menu']."&ssmenu=".$_GET['ssmenu']."&itemtype=$itemtype", $out);     
                  $out = preg_replace('/(<a[^.]*showHideDiv[^>])(.*?)(<\/a>)/', '', $out);         
                  preg_match_all('/(<div id=\'menu_navigate[^>])(.*?)(<\/div>)/', $out, $matches);
                  $out = preg_replace('/(<div id=\'menu_navigate[^>])(.*?)(<\/div>)/', '', $out);
                  
                  //show select in native 
                  $out = str_replace('<select', "<select data-native-menu='true'", $out);           
                  
                  $common->displayTabBar($matches[0]);
                           
                  ob_start();
                  $this->showButtons($itemtype, $ID);
                  $buttons_form = ob_get_contents();      
                  ob_end_clean();
                  $out .= $buttons_form;
         
                  echo $out;*/
         $savecolslimit = $_SESSION['plugin_mobile']['cols_limit'];
         $saverowslimit = $_SESSION['plugin_mobile']['rows_limit'];
         $_SESSION['plugin_mobile']['cols_limit'] = 1;
         $_SESSION['plugin_mobile']['rows_limit'] = 50;
         $_GET['showheader'] = false;
         echo "<div class='ui-grid-a' style='position:relative;'>";
         echo "<div id='left_panel' class='ui-block-a'>";
         echo "<div data-role='header' data-backbtn='false' data-theme='a' data-id='TabBar'>";
         echo "<div data-theme='c' class='ui-btn-right' style='top:0' data-position='inline'>";
         echo "<a data-role='button' data-theme='c'>test</a>";
         echo "</div></div>";
         echo "<div style='height:600px;'>";
         PluginMobileSearch::manageGetValues($itemtype);
         //Search::manageParams($itemtype);
         $numrows = PluginMobileSearch::show(ucfirst($itemtype));
         echo "</div>";
         echo "</div>";
         echo "<div class='ui-block-b' id='right_panel'>";
         PluginMobileTab::displayTabBar();
         echo "<div style='height:570px;'>";
         $_SESSION['plugin_mobile']['cols_limit'] = $savecolslimit;
         $_SESSION['plugin_mobile']['rows_limit'] = $saverowslimit;
     } else {
         PluginMobileTab::displayTabBar();
     }
     $obj->getFromDB($ID);
     $p['itemtype'] = $_REQUEST['itemtype'];
     //$p['itemtype'] = '';
     $p['id'] = false;
     $p['return_fields'] = array();
     $p['show_label'] = true;
     $p['show_name'] = true;
     foreach ($params as $key => $value) {
         $p[$key] = $value;
     }
     if (largeScreen()) {
         $obj = $this->removeBlacklistedField($obj);
         $nb_items = count($obj->fields);
         $tmp = array_chunk($obj->fields, ceil($nb_items / 2), true);
         $fields1 = $tmp[1];
         $fields2 = $tmp[0];
         $params1 = array('data' => $fields1, 'options' => $p, 'searchOptions' => $obj->getSearchOptions(), 'itemtype' => $itemtype);
         $params2 = $params1;
         $params2['data'] = $fields2;
         $this->getLabels($params1, $labels1);
         $this->getLabels($params2, $labels2);
         //echo $fields1 ."<br>";
         //echo count($labels2)."<br>";
         echo "<div class='ui-grid-a' id='tablet-grid'>";
         echo "<div class='ui-block-a'>";
         $this->showList($labels1, $itemtype);
         echo "</div>";
         echo "<div class='ui-block-b'>";
         $this->showList($labels2, $itemtype);
         echo "</div>";
         echo "</div>";
     } else {
         $params = array('data' => $obj->fields, 'options' => $p, 'searchOptions' => $obj->getSearchOptions(), 'itemtype' => $itemtype);
         $this->getLabels($params, $labels);
         unset($labels['id']);
         $this->showList($labels, $itemtype);
     }
     if (editMode()) {
         $this->showButtons($itemtype, $ID);
     }
     if (largeScreen() && DISPLAYLEFTPANEL) {
         echo "</div></div></div>";
     }
     // restoreActiveProfile();
     //Close Form
     //echo "</form>";
     Html::closeForm();
     $common->displayFooter();
 }
예제 #2
0
 public function showSpecificMenu($item)
 {
     global $LANG, $CFG_GLPI;
     $menu = $this->getMenu();
     $class = "";
     if (largeScreen()) {
         $class = "class='ui-grid-a'";
     }
     echo "<div data-role='content'>";
     echo "<ul data-role='listview' data-inset='true' data-theme='c' data-dividertheme='a' {$class}>";
     echo "<li data-role='list-divider'>";
     echo "<img src='" . $CFG_GLPI["root_doc"] . "/plugins/mobile/pics/" . $menu[$item]['icon'] . "' class='title_icon' />";
     echo $menu[$item]['title'] . "</li>";
     $cpt = 0;
     foreach ($menu[$item]['content'] as $key => $val) {
         if (isset($val['page']) && isset($val['title'])) {
             $link = $CFG_GLPI["root_doc"] . $val['page'];
             $link = $CFG_GLPI["root_doc"] . "/plugins/mobile" . $val['page'];
             $external = "";
             if (isset($val['external']) && $val['external']) {
                 $external = "rel='external'";
             }
             if (largeScreen()) {
                 $class = "class='ui-block-" . chr($cpt % 2 + 97) . "'";
             }
             echo "<li {$class}>";
             if (isset($val['icon'])) {
                 echo "<img src='" . $CFG_GLPI["root_doc"] . "/plugins/mobile/pics/" . $val['icon'] . "' class='ui-li-icon round-icon' />";
             }
             echo "<a href='{$link}' data-back='false' {$external}>" . $val['title'] . "</a>";
             echo "</li>\n";
             $cpt++;
         }
     }
     echo "</ul>";
     echo "</div>";
 }