/** * generic_list * * @param string $object the object class to list * * @access public * @return string */ function generic_list($request) { $object = $request->getParam('object'); $object_name = get_object_name($object); $object_name_plural = get_plural($object_name); $objects = Doctrine::getTable($object)->findAll(); $data = array(); $data[$object_name_plural] = $objects; return render("{$object_name}_list.html", $data); }
function createOldHeaderData() { global $gbl, $sgbl, $login, $ghtml; global $gdata; $homedesc = $login->getKeywordUc('home'); $deskdesc = $login->getKeywordUc('desktop'); $aboutdesc = $login->getKeywordUc('about'); $domaindesc = get_plural(get_description('domain')); $clientdesc = get_plural(get_description('client')); $slavedesc = get_description('pserver'); $ticketdesc = get_plural(get_description('ticket')); $ssessiondesc = get_description('ssession'); $systemdesc = $login->getKeywordUc('system'); $logoutdesc = $login->getKeywordUc('logout'); $helpdesc = $login->getKeywordUc('help'); $ffiledesc = get_plural(get_description("ffile")); $alldesc = $login->getKeywordUc('all'); if ($login->isAdmin()) { $doctype = "admin"; $domainclass = "domain"; } else { $doctype = "client"; $domainclass = "domain"; } if (check_if_many_server()) { $serverurl = $ghtml->getFullUrl('a=list&c=pserver'); $slavedesc = get_plural($slavedesc); } else { $serverurl = $ghtml->getFullUrl('k[class]=pserver&k[nname]=localhost&a=show'); } if ($login->is__table('client')) { $ffileurl = $ghtml->getFullUrl('k[class]=ffile&k[nname]=/&a=show'); } else { $ffileurl = $ghtml->getFullUrl('n=web&k[class]=ffile&k[nname]=/&a=show'); } $gob = $login->getObject('general')->generalmisc_b; if (isset($gob->ticket_url) && $gob->ticket_url) { $url = $gob->ticket_url; $url = add_http_if_not_exist($url); $ticket_url = "javascript:window.open('{$url}')"; } else { $ticket_url = "/display.php?frm_action=list&frm_o_cname=ticket"; } $helpurl = "http://wiki.lxcenter.org"; $gdata = array("desktop" => array($deskdesc, "/display.php?frm_action=desktop", "client_list.gif"), "home" => array($homedesc, "/display.php?frm_action=show", "client_list.gif"), "all" => array($alldesc, "/display.php?frm_action=list&frm_o_cname=all_domain", "client_list.gif"), "domain" => array($domaindesc, "/display.php?frm_action=list&frm_o_cname={$domainclass}", "domain_list.gif"), "system" => array($systemdesc, "/display.php?frm_action=show&frm_o_o[0][class]=pserver&frm_o_o[0][nname]=localhost", "pserver_list.gif"), "client" => array($clientdesc, "/display.php?frm_action=list&frm_o_cname=client", "client_list.gif"), "ffile" => array($ffiledesc, $ffileurl, "client_list.gif"), "pserver" => array($slavedesc, $serverurl, "pserver_list.gif"), "ticket" => array($ticketdesc, $ticket_url, "ticket_list.gif"), "ssession" => array($ssessiondesc, "/display.php?frm_action=list&frm_o_cname=ssessionlist", "ssession_list.gif"), "about" => array($aboutdesc, "/display.php?frm_action=about", "ssession_list.gif"), "help" => array($helpdesc, "javascript:window.open('{$helpurl}/')", "ssession_list.gif"), "logout" => array("<font color=red>{$logoutdesc}<font >", "javascript:top.mainframe.logOut();", "delete.gif")); }
function createShowAlist(&$alist, $subaction = null) { //$alist[] = "a=show"; global $gbl, $sgbl, $login, $ghtml; $alist['__title_security'] = "Security"; $alist[] = "a=show&o=sshconfig"; $alist[] = "a=show&o=lxguard"; $alist[] = "a=list&c=hostdeny"; $alist[] = "a=list&c=sshauthorizedkey"; $alist['__title_main'] = $this->getTitleWithSync(); //$alist['property'][] = "a=updateForm&sa=update"; //$this->getCPToggleUrl($alist); //$alist[] = "a=list&c=vps"; $alist[] = "a=show&o=dirlocation"; $alist[] = "a=updateform&sa=savevpsdata"; $alist[] = "a=updateform&sa=importhypervmvps"; $alist[] = "a=updateform&sa=commandcenter"; //$alist[] = "a=updateform&sa=backupconfig"; //$alist[] = "a=list&c=component"; if ($sgbl->isDebug()) { $alist[] = 'a=updateform&sa=ssl_key'; $alist[] = "a=show&o=kloxo"; } $alist[] = "a=updateform&sa=mysqlpasswordreset"; $alist[] = 'a=list&c=ipaddress'; $alist[] = 'a=updateform&sa=centralbackupconfig'; $alist['__title_next'] = get_plural(get_description('service')); $cnl = array('service', 'cron', 'process'); foreach ($cnl as $cn) { $alist = $this->getListActions($alist, $cn); } //$this->driverApp->createShowAlist($alist); $alist[] = "a=show&o=sshclient"; $alist[] = "a=show&o=llog"; //$alist[] = "a=updateform&sa=phpsmtp"; $alist[] = "a=show&l[class]=ffile&l[nname]="; //$alist[] = "a=list&c=firewall"; //$alist[] = "a=show&o=proxy"; //$alist[] = "a=updateform&sa=update&c=serverspam"; $alist['__title_nnn'] = 'Machine'; $alist[] = "a=updateform&sa=importvps"; $alist[] = "a=show&o=driver"; //$alist[] = "a=update&sa=loaddriverinfo"; $alist[] = "a=updateForm&sa=reboot"; //$alist[] = "a=updateForm&sa=poweroff"; return $alist; }
function createShowAlist(&$alist, $subaction = null) { //$alist[] = "a=show"; global $gbl, $sgbl, $login, $ghtml; $alist['__title_main'] = $login->getKeywordUc('config'); if ($this->isLocalhost('nname')) { $alist[] = "a=show&o=lxupdate"; } $alist['property'][] = "a=updateform&sa=password"; //$this->getCPToggleUrl($alist); $alist[] = "a=updateform&sa=showused"; //$alist[] = "a=list&c=component"; $cnl = array('ipaddress', 'dbadmin'); foreach ($cnl as $cn) { $alist = $this->getListActions($alist, $cn); } $alist['__title_next'] = get_plural(get_description('service')); $cnl = array('service', 'cron', 'process', 'uuser'); foreach ($cnl as $cn) { $alist = $this->getListActions($alist, $cn); } $this->driverApp->createShowAlist($alist); //$alist[] = "a=updateform&sa=phpsmtp"; $alist[] = "a=show&l[class]=ffile&l[nname]="; //$alist[] = "a=list&c=firewall"; //$alist[] = "a=show&o=proxy"; //$alist[] = "a=updateform&sa=update&c=serverspam"; $alist['__title_nnn'] = 'Machine'; $alist[] = "a=show&o=driver"; //$alist[] = "a=update&sa=loaddriverinfo"; $alist[] = "a=updateForm&sa=reboot"; $alist[] = "a=updateForm&sa=poweroff"; return $alist; }
function __ajax_desc_tree() { global $gbl, $sgbl, $login, $ghtml; $object = $gbl->__c_object; $icondir = get_image_path('/button/'); $rclist = $object->getResourceChildList(); $cid = $ghtml->node; if ($object->hasFileResource()) { $u = "a=show&k[class]=ffile&k[nname]=/"; $u = $ghtml->getFullUrl($u); $v = createClName('ffile', '/'); $ret[] = array('text' => "File", 'icon' => "{$icondir}/ffile_show.gif", 'hrefTarget' => 'mainframe', 'href' => $u, 'id' => "{$cid}&{$v}"); } if ($ghtml->__resource_class) { $c = strfrom($ghtml->__resource_class, "__resource_"); if (cse($c, "_l")) { $clname = $object->getChildNameFromDes($c); $list = $object->getList($clname, $totalcount); foreach ($list as $o) { $u = "a=show&k[class]={$o->getClass()}&k[nname]={$o->nname}"; $u = $ghtml->getFullUrl($u); $ret[] = array('text' => basename($o->nname), 'icon' => "{$icondir}/{$o->getClass()}_list.gif", 'hrefTarget' => 'mainframe', 'href' => $u, 'id' => "{$cid}&{$o->getClName()}"); } } else { if (cse($c, "_o")) { $clname = $object->getChildNameFromDes($c); $o = $object->getObject($clname); $u = "a=show&o={$o->getClass()}"; $u = $ghtml->getFullUrl($u); $ret[] = array('text' => $o->getClass(), 'icon' => "{$icondir}/{$o->getClass()}_show.gif", 'hrefTarget' => 'mainframe', 'href' => $u, 'id' => "{$cid}&{$o->getClass()}"); } } return $ret; } if ($ghtml->__title_function) { $t = $ghtml->__title_function; $alist = $object->createShowAlist($alist); foreach ($alist as $k => $v) { if (csb($k, "__title")) { if ($k !== $t) { if ($insidetitle) { $insidetitle = false; break; } continue; } $insidetitle = true; continue; } if ($insidetitle) { $url = $ghtml->getFullUrl($v); if ($ghtml->is_special_url($url)) { continue; } $urlinfo = $ghtml->getUrlInfo($url); $ret[] = array('text' => $urlinfo['description']['desc'], 'icon' => $urlinfo['image'], 'hrefTarget' => 'mainframe', 'leaf' => true, 'href' => $url, 'id' => "&end"); } } return $ret; } if ($object->hasFunctions()) { $alist = $object->createShowAlist($alist); foreach ($alist as $k => $v) { if (!csb($k, "__title")) { continue; } $title = strfrom($k, "__title_"); if ($title === 'mailaccount') { continue; } if ($title === 'custom') { continue; } $icon = "{$icondir}/__title_{$title}.gif"; if (!lxfile_exists("__path_program_htmlbase/{$icon}")) { //lfile_put_contents("title.img", "$title.gif\n", FILE_APPEND); $icon = null; } $ret[] = array('text' => $v, 'icon' => $icon, 'hrefTarget' => '', 'href' => null, 'id' => "{$cid}&{$k}"); } } foreach ($rclist as $c) { $clname = $object->getChildNameFromDes($c); $desc = get_description($clname); $desc = get_plural($desc); $url = $ghtml->getFullUrl("a=list&c={$clname}"); $ret[] = array('text' => $desc, 'icon' => "{$icondir}/{$clname}_list.gif", 'hrefTarget' => 'mainframe', 'href' => $url, 'id' => "{$cid}&__resource_{$c}"); } return $ret; }
function printSelectObjectTable($name_list, $parent, $class, $blist = array(), $display = null) { global $gbl, $sgbl, $login, $ghtml; print_time("{$class}.objecttable"); if ($this->frm_accountselect !== null) { $sellist = explode(',', $this->frm_accountselect); } else { $sellist = null; } $classdesc = $this->get_class_description($class, $display); $unique_name = trim($parent->nname) . trim($class) . trim($display) . trim($classdesc[2]); $unique_name = fix_nname_to_be_variable($unique_name); $filtername = $parent->getFilterVariableForThis($class); $fil = $this->frm_hpfilter; $sortdir = null; $sortby = null; if (isset($fil[$filtername]['sortby'])) { $sortby = $fil[$filtername]['sortby']; } if (isset($fil[$filtername]['sortdir'])) { $sortdir = $fil[$filtername]['sortdir']; } $pagesize = '99999'; $iconpath = get_image_path() . "/button"; $nlcount = count($name_list) + 1; $imgheadleft = $login->getSkinDir() . "/top_lt.gif"; $imgheadleft2 = $login->getSkinDir() . "/top_lt.gif"; $imgheadright = $login->getSkinDir() . "/top_rt.gif"; $imgheadbg = $login->getSkinDir() . "/top_bg.gif"; $imgbtnbg = $login->getSkinDir() . "/btn_bg.gif"; $imgtablerowhead = $login->getSkinDir() . "/tablerow_head.gif"; $imgtablerowheadselect = $login->getSkinDir() . "/top_line_medium.gif"; $imgbtncrv = $login->getSkinDir() . "/btn_crv.gif"; $imgtopline = $login->getSkinDir() . "/top_line.gif"; $classdesc = $this->get_class_description($class); $unique_name = trim($parent->nname) . trim($class) . trim($classdesc[2]); $unique_name = fix_nname_to_be_variable($unique_name); //dprint("-- ".$unique_name. " --", 2); ?> <br /> <script> var ckcount<?php echo $unique_name; ?> ; </script> <?php $tsortby = $sortby; if (!$sortby) { $tsortby = exec_class_method($class, "defaultSort"); } if (!$sortdir) { $sortdir = exec_class_method($class, "defaultSortDir"); } //print_time("objecttable"); $obj_list = $parent->getVirtualList($class, $total_num, $tsortby, $sortdir); //print_time("objecttable", 'objecttable'); if (!$sellist) { //$total_num = $this->display_count($obj_list, $display) ; } ?> <table width=100%> <tr> <td align=center> <table cellspacing=2 cellpadding=2 width=97% align=center> <tr><td class=rowpoint></td><td colspan= <?php echo $nlcount; ?> > <table cellpadding=0 cellspacing=0 border=0 width=100%> <tr><td valign=bottom ></td> <td> <?php if (isset($ghtml->__http_vars['frm_hpfilter'][$filtername]['pagenum'])) { $cgi_pagenum = $ghtml->__http_vars['frm_hpfilter'][$filtername]['pagenum']; } else { $cgi_pagenum = 1; } if (!$sellist) { $this->print_next_previous($parent, $class, "top", $cgi_pagenum, $total_num, $pagesize); } ?> </td> <td align=right valign=bottom > <?php if (!$sellist) { ?> <table cellpadding="0" cellspacing="0" border="0" height="27" > <tr><td><img src="<?php echo $imgheadleft; ?> "></td><td nowrap valign=middle background="<?php echo $imgheadbg; ?> "><b><font color="#ffffff"><?php echo get_plural($classdesc[2]); ?> under <?php echo $parent->display("nname"); ?> </b> <?php echo $this->print_machine($parent); ?> <b> (<?php echo $total_num; ?> )</b></font></td><td><img src="<?php echo $imgheadright; ?> "></td></tr> </table> </td> </tr> <tr><td colspan=3><table cellpadding=0 cellspacing=0 border=0 width=100% height=35 background="<?php echo $imgbtnbg; ?> "> <tr><td><img src="<?php echo $imgbtncrv; ?> "></td><td width=80% align=left > <table width=100% cellpadding=0 cellspacing=0 border=0><tr><td valign=bottom><?php $this->print_list_submit($class, $blist, $unique_name); ?> </td></tr></table></td><td width=15% align=right><b><font color="#ffffff"><?php $this->print_search($parent, $class); ?> </font></b></td></tr> </table> </td></tr> </td></tr><tr><td height=2 colspan=2></td></tr></table> <?php } else { $descr = $this->getActionDescr($_SERVER['PHP_SELF'], $this->__http_vars, $class, $var, $identity); ?> <table cellpadding=0 cellspacing=0 border=0 width=100%><tr><td width=70% valign=bottom><table cellpadding=0 cellspacing=0 border=0 width=100%><tr><td width=100% height=2 background="<?php echo $imgtopline; ?> "></td></tr></table></td><td align=right><table cellpadding=0 cellspacing=0 border=0 width=100% ><tr><td><img src="<?php echo $imgheadleft; ?> "></td><td nowrap width=100% background="<?php echo $imgheadbg; ?> " ><b><font color="#ffffff"> Confirm <?php echo $descr[1]; ?> : </b><?php echo get_plural($classdesc[2]); ?> from <?php echo $parent->display("nname"); ?> </font></td><td><img src="<?php echo $imgheadright; ?> "></td></tr></table></td></tr></table> </td></tr><tr><td height=0 colspan=2></td></tr></table> <?php } ?> <!-- </td></tr><tr><td height=2 colspan=2></td></tr></table> --> <tr><td bgcolor="#ffffff"></td> <?php $imguparrow = get_general_image_path() . "/button/uparrow.gif"; $imgdownarrow = get_general_image_path() . "/button/downarrow.gif"; foreach ($name_list as $name => $width) { $desc = "__desc_{$name}"; $descr[$name] = get_classvar_description($class, $desc); if (!$descr[$name]) { print "Cannot access static variable {$class}::{$desc}"; exit(0); } if (csa($descr[$name][2], ':')) { $_tlist = explode(':', $descr[$name][2]); $descr[$name][2] = $_tlist[0]; } foreach ($descr[$name] as &$d) { if ($this->is_special_url($d)) { continue; } if (strstr($d, "%v") !== false) { $d = str_replace("[%v]", $classdesc[2], $d); } } if ($width === "100%") { $wrapstr = "wrap"; } else { $wrapstr = "nowrap"; } if ($sortby && $sortby === $name) { $wrapstr .= " background={$imgtablerowheadselect}"; print "<td width={$width} {$wrapstr} ><table cellpadding=0 cellspacing=0 border=0> <tr> <td rowspan=2 {$wrapstr}>"; } else { $wrapstr .= " background={$imgtablerowhead}"; print "<td width={$width} {$wrapstr} class=col>"; } ?> <b><?php $this->print_sortby($parent, $class, $unique_name, $name, $descr[$name]); ?> </b></font> <?php $imgarrow = $sortdir === "desc" ? $imgdownarrow : $imguparrow; if ($sortby && $sortby === $name) { print "</td> <td width=15><img src=" . $imgarrow . " ></td><td ></td></tr></table>"; } ?> </td> <?php } $count = 0; $rowcount = 0; ?> <td width=10 background=<?php echo $imgtablerowhead; ?> > <form name="formselectall<?php echo $unique_name; ?> " value=hello> <input type=checkbox name="selectall<?php echo $unique_name; ?> " value=on <?php if ($sellist) { echo "checked disabled"; } ?> onclick="javascript:calljselectall<?php echo $unique_name; ?> ()"></form> </td> <?php print "</tr> "; print_time('loop'); $n = 1; foreach ((array) $obj_list as $okey => $obj) { $checked = ''; // Fix This. if ($sellist) { $checked = "checked disabled"; if (!array_search_bool($obj->nname, $sellist)) { continue; } } $imgpointer = get_general_image_path() . "/button/pointer.gif"; $imgblank = get_general_image_path() . "/button/blank.gif"; ?> <script> loadImage('<?php echo $imgpointer; ?> ') </script> <script> loadImage('<?php echo $imgblank; ?> ') </script> <tr id=tr<?php echo $unique_name . $rowcount; ?> class=tablerow<?php echo $count; ?> onmouseover=" swapImage('imgpoint<?php echo $rowcount; ?> ','','<?php echo $imgpointer; ?> ',1);" onmouseout="swapImgRestore();"> <td id=td<?php echo $unique_name . $rowcount; ?> width=5 class=rowpoint><img name=imgpoint<?php echo $rowcount; ?> src="<?php echo $imgblank; ?> "></td> <?php $colcount = 1; foreach ($name_list as $name => $width) { $this->printObjectElement($parent, $class, $classdesc, $obj, $name, $width, $descr, $colcount . "_" . $rowcount); $colcount++; } $basename = basename($obj->nname); $selectshowbase = $this->frm_selectshowbase; // issue #609 // $ret = strfrom($parent->nname, $selectshowbase); $ret = str_replace('//', '/', strfrom($parent->nname, $selectshowbase)); print " <td width=10 >"; print "<a class=button href=\"javascript:callSetSelectFolder('/{$ret}/{$basename}')\">"; print " Select </a>"; print "</tr> "; if ($count === 0) { $count = 1; } else { $count = 0; } $rowcount++; if (!$sellist) { if ($n === $pagesize * $cgi_pagenum) { break; } } $n++; } print_time('loop', "loop{$n}"); print "<tr><td></td><td colspan={$nlcount}>"; if (!$rowcount) { if ($ghtml->frm_searchstring) { ?> <table width=95%> <tr align=center> <td width=100%> <b> No Matches Found </b> </td> </tr> </table> <?php } else { ?> <table width=95%> <tr align=center> <td width=100%> <b> No <?php echo get_plural($classdesc[2]); ?> under <?php echo $parent->nname; ?> </b> </td> </tr> </table> <?php } } print "</td></tr>"; print "<tr><td class=rowpoint></td><td colspan=" . $nlcount . " >\n <table cellpadding=0 cellspacing=0 border=0 width=100%>\n <tr height=1 style='background:url({$imgtopline})'><td></td></tr>\n <tr><td>"; ?> <script>ckcount<?php echo $unique_name; ?> = <?php echo $rowcount . "; "; ?> function calljselectall<?php echo $unique_name; ?> (){ jselectall(document.formselectall<?php echo $unique_name; ?> .selectall<?php echo $unique_name; ?> ,ckcount<?php echo $unique_name; ?> ,'<?php echo $unique_name; ?> ') } </script> <?php print "<table> <tr> <td >"; print "<a class=button href=\"javascript:window.close()\"> Cancel </a> "; print "</td> <td width=30> </td> <td >"; print "</td> </tr> </table> "; print "</td></tr></table></tr></table></td> </tr> </table>"; //else { // // $this->print_list_submit($blist); // } //print_time("$class.objecttable", "$class.objecttable"); /// Important. This is to make sure that the session saving etc doesn't take place. We just need a plain and clean window without any saving. If this happens the current url gets added to the sessiona and redirection will screw up. exit; }
function print_menulist($name, $alist, $base, $type) { global $gbl, $sgbl, $login, $ghtml; foreach ((array) $alist as $k => $a) { if (is_array($a)) { continue; if ($k === 'home') { continue; } if ($this->is_special_url($a)) { continue; } if (csb($k, "__title")) { continue; } $desc = get_plural($k); $menuimg = "/img/image/" . $login->getSpecialObject('sp_specialplay')->icon_name . "/button/browse.gif"; $endimg = "/img/right_point.gif"; $desc = "<font style=font-weight:bold>{$desc}</font>"; $mnu = $this->getMenuDescrString($menuimg, $desc, $endimg); print "window.{$name}{$k} = new Menu(\"{$mnu}\", 100);\n"; foreach ($a as $nk => $nv) { $nv = $this->getFullUrl($nv, $base); $this->print_pmenu("{$name}{$k}", $nv); } } } print "window.{$name} = new Menu('{$name}',130);\n"; if ($type === 'slist') { $aa = $this->getFullUrl('a=show', $base); $this->print_pmenu($name, $aa); } foreach ((array) $alist as $k => $a) { if (!strcmp($k, 'home')) { continue; } if ($this->is_special_variable($a)) { continue; } if (csb($k, "__title")) { continue; } if (is_array($a)) { continue; } else { // Hack hack... NOt showing addforms in the top Menu... Also not showing in the tree view.. if (csa(strtolower($a), "addform") || csa(strtolower($a), 'update') && !csa(strtolower($a), 'updateform')) { continue; } if (!csb($k, "__v_")) { $a = $this->getFullUrl($a, $base); $this->print_pmenu($name, $a); } } } }
<?php } elseif ($sidebar_type != 'user') { ?> <span class="number"><?php echo round($row->total); ?> </span> point<?php echo get_plural($row->total); } else { $points = get_score($row->username); ?> <span class="number"><?php echo $points; ?> </span> point<?php echo get_plural($points); } ?> </li> <li class="fourth_column center"> <?php echo get_follow($username, $row->username); if ($body_title == 'Leaderboard' && $username == $row->username) { ?> <a href="http://twitter.com/?status=I'm the <?php echo add_suffix($rank); ?> overall in OneExtraLap!">Tweet about your rank.</a> <?php } ?>
<b id="following"><?php echo $sidebar_stats["following"]; ?> </b><br /> following </a> </li> <li> <a href="/<?php echo $userid; ?> /followers"> <b id="follower"><?php echo $sidebar_stats["follower"]; ?> </b><br /> follower<span id="sss"><?php echo get_plural($sidebar_stats["follower"]); ?> </span> </a> </li> </ul> <div class="clear"></div> </div> <?php } ?> <div class="info user_info"> <?php if (get_website($userid, FALSE) != "") { ?> <div class="left">URL</div>
function __ac_desc_delete($object) { global $gbl, $sgbl, $login, $ghtml; $cname = $ghtml->frm_o_cname; if ($login->isDemo()) { throw new lxException("cannot_delete_in_demo", $pk); } $ghtml->print_message(); $ll = explode(',', $ghtml->frm_accountselect); if ($ghtml->frm_confirmed === "yes") { do_desc_delete($object, $cname, $ll); $desc = get_classvar_description($cname); $gbl->__this_redirect = $gbl->getSessionV("lx_delete_return_url") . "&frm_smessage={$desc['2']}+successfully+deleted."; if ($cname === 'domain' || $cname === 'client' || $cname === 'vps') { $gbl->setSessionV('__refresh_lpanel', 'true'); } } else { $gbl->setSessionV("lx_delete_return_url", $gbl->getHttpReferer()); if (exec_class_method($cname, 'isTreeForDelete')) { print "<br> <table width=100%> <tr> <td width=10> </td><td align=left> These Objects Under these " . get_plural($object->getClass()) . " will also be Deleted.<br> <br></td></tr></table>"; foreach ($ll as $l) { $o = $object->getFromList($cname, $l); $ghtml->do_resource(null, $o, 6, false, "getResourceChildList", true, false); } } do_list_class($object, $cname); } }
function print_info($info) { $date = (new DateTime())->format('Y-m-d H:i:s'); echo '<div class="padding" id="details">'; if (isset($info['userID'])) { $type = "user"; echo '<h2>Brukerinformasjon</h2>'; } else { if (isset($info['bookID'])) { $type = "book"; echo '<h2>Bokinformasjon</h2>'; } else { if (isset($info['shelfID']) || isset($info['shelfNR'])) { $type = "shelf"; echo '<h2>Hylle informasjon</h2>'; } else { return false; } } } //Print general info echo '<table cellspacing=0><form method="POST" action="' . URL_ROOT . 'modify/' . $type . '/' . $info[$type . "ID"] . '/' . $info[$type . "ID"] . '">'; foreach ($info as $key => $inf) { if (!is_array($inf)) { if ($key != "userID" && $key != "bookID" && ($key != "shelfID" || $type == "book") && $key != "username" && $key != "registered") { if ($key == "sex") { echo '<tr><td>Kjønn</td><td><select name="' . $key . '">'; $descs = array("Ikke spesifisert", "Gutt", "Jente"); for ($i = 0; $i < count($descs); $i++) { $selected = ''; if ($i == $inf) { $selected = 'selected="selected"'; } echo '<option value="' . $i . '" ' . $selected . '>' . $descs[$i] . '</option>'; } echo '</select></td></tr>'; } else { if ($key == "approved_date") { echo '<tr><td>Godkjent</td><td><select name="' . $key . '"><option value="null">Ikke godkjent</option>'; $selected = ''; $approved_date = date("Y-m-d H:i:s"); if ($inf != null) { $selected = 'selected="selected"'; $approved_date = $inf; } echo '<option value="' . $approved_date . '" ' . $selected . '>Godkjent ' . $inf . '</option>'; echo '</select></td></tr>'; } else { if ($key == "shelfID" && $type != "shelf") { $sel = ""; if ($inf == 0) { $sel = "selected='selected'"; } echo '<tr><td>Hylle</td><td><select name="' . $key . '"><option value="0" ' . $sel . '>Ingen hylle</option>'; include 'list.class.php'; $_list = new Lists("shelves"); $list = $_list->getList(); foreach ($list as $shelf) { $selected = ""; if ($inf == $shelf['shelfID']) { $selected = "selected='selected'"; } echo '<option value="' . $shelf['shelfID'] . '" ' . $selected . '>' . $shelf['name'] . '</option>'; } echo '</select></td></tr>'; } else { if ($key == 'birth') { $datee = explode(" ", $inf)[0]; $date = explode("-", $datee); echo '<tr><td>Fødselsdag</td><td><select name="' . $key . '_day">'; for ($i = 1; $i <= 31; $i++) { if ($i < 10) { $i = '0' . $i; } $selected = ''; if ($i . "" == "" . $date[2]) { $selected = 'selected="selected"'; } echo "<option value='{$i}' {$selected}>" . $i . "</option>"; } echo '</select> <select name="' . $key . '_month">'; for ($i = 1; $i <= 12; $i++) { if ($i < 10) { $i = '0' . $i; } $selected = ''; if ($i . "" == "" . $date[1]) { $selected = 'selected="selected"'; } echo "<option value='{$i}' {$selected}>" . $i . "</option>"; } echo '</select> <select name="' . $key . '_year">'; for ($i = (int) date("Y"); $i >= (int) date("Y") - 80; $i--) { $selected = ''; if ($i == $date[0]) { $selected = 'selected="selected"'; } echo "<option value='{$i}' {$selected}>" . $i . "</option>"; } echo '</select></td></tr>'; } else { if ($key == "type") { echo '<tr><td>Type</td><td><select name="' . $key . '">'; $types = array('blad', 'bok', 'film', 'lydbok'); foreach ($types as $typi) { $selected = ''; if ($inf == $typi) { $selected = 'selected="selected"'; } echo "<option value='{$typi}' {$selected}>{$typi}</option>"; } echo '</select></td></tr>'; } else { if ($key == "language") { echo '<tr><td>Språk</td><td><select name="' . $key . '">'; $languages = array('Engelsk', 'Norsk'); foreach ($languages as $lang) { $selected = ''; if ($inf == $lang) { $selected = 'selected="selected"'; } echo "<option value='{$lang}' {$selected}>{$lang}</option>"; } echo '</select></td></tr>'; } else { echo '<tr> <td>' . $key . '</td> <td><input type="text" name="' . $key . '" maxlength=400 value="' . $inf . '" /></td> </tr>'; } } } } } } } else { echo '<tr> <td>' . $key . '</td> <td>' . $inf . '</td> </tr>'; } } } echo '<tr><td colspan=2><button>Oppdater</button></td></tr></form></table>'; //Contact info if ($type == "user") { //Contact info if (isset($info['contact']) && is_array($info['contact'])) { echo '<h2>Kontaktinformasjon</h2>'; echo '<table cellspacing=0><tr><th>Telefon</th><th>Email</th><th colspan=2>Comment</th></tr>'; foreach ($info['contact'] as $contact) { echo '<tr><form action="' . URL_ROOT . 'modify/contact/' . $contact['contactID'] . '/' . $info[$type . "ID"] . '" method="POST">'; foreach ($contact as $key => $cont) { if ($key != "contactID") { echo '<td><input type="text" maxlength=300 name="' . $key . '" value="' . $cont . '" /></td>'; } } echo '<td><button>Oppdater</button><input type="button" value="Slett" onclick="window.location.href = \'' . URL_ROOT . 'contact/delete/' . $contact['contactID'] . '/' . $info[$type . "ID"] . '\'" /></td>'; echo '</form></tr>'; } echo '<tr><td colspan=4><input type="button" value="Legg til" onclick="window.location.href = \'' . URL_ROOT . 'contact/add/' . $info[$type . "ID"] . '\'" /></td></tr>'; echo '</table>'; } } //Settings if ($type == 'user') { if (isset($info['settings']) && is_array($info['settings'])) { echo '<h2>Innstillinger</h2>'; /*'public_photos' => 0, 'save_log' => 0, 'save_visits' => 0, 'preferred_contact' => 0*/ echo '<form action="' . URL_ROOT . 'modify/setting/' . $info['settings']["settingID"] . '/' . $info[$type . "ID"] . '" method="POST"><table cellspacing=0>'; foreach ($info['settings'] as $keyy => $vall) { if ($keyy == "settingID") { echo "<input type='hidden' name='{$keyy}' value='{$vall}' />"; } else { if ($keyy == "preferred_contact") { echo '<tr><td>Foretrukket kontakt</td><td><select name="' . $keyy . '">'; //List contact-infos and display them by their comment foreach ($info['contact'] as $contact) { echo '<option value="' . $contact['contactID'] . '">' . $contact['comment'] . '</option>'; } echo '</select></td></tr>'; } else { echo '<tr><td>' . $keyy . '</td><td><select name="' . $keyy . '">'; $poss_vals = array(0 => 'Ikke tillatt', 1 => 'Tillatt'); foreach ($poss_vals as $k => $v) { $se = ''; if ($k == $vall) { $se = 'selected="selected"'; } echo '<option value="' . $k . '" ' . $se . '>' . $v . '</option>'; } echo '</select></td></tr>'; } } } echo '<tr><td colspan=2><button>Oppdater</button></td></tr></table></form>'; } } //RFID echo '<h2>RFID</h2>'; if (isset($info['rfid']) && is_array($info['rfid'])) { echo '<table cellspacing=0>'; foreach ($info['rfid'] as $key => $rfid) { echo '<tr><td>'; //echo '<form action="'.URL_ROOT.'modify/rfid" method="POST" id="rfid_'.$key.'">'; echo '<form action="' . URL_ROOT . 'modify/rfid/' . get_plural($type) . '/' . $info[$type . "ID"] . '" method="POST" id="rfid_' . $key . '">'; echo '<p class="p ' . $rfid[0] . '" style="display:inline;">' . $rfid[0] . '</p>'; echo '<input type="hidden" name="original" class="original" value="' . $rfid[0] . '" />'; echo '<input type="hidden" name="new" class="new" />'; if ($type == "book") { echo '<input type="hidden" name="_shelfID" value="' . $rfid[2] . '" />'; } echo '</form></td>'; echo '<td style="border-right: 1px solid black;"><input type="button" value="Endre" onclick="change_rfid(' . $key . ')" /> <input type="button" value="Slett" onclick="window.location.href=\'' . URL_ROOT . 'rfid/delete/' . $rfid[0] . '/' . $type . '/' . $info[$type . "ID"] . '\'" /></td>'; if ($type == "book") { echo '<td><form action="' . URL_ROOT . 'modify/rfid/' . get_plural($type) . '/' . $info[$type . "ID"] . '" method="POST">'; echo '<select style="display:inline;" name="_shelfID">'; $selected = ''; if ($rfid[2] == 0) { $selected = "selected='selected'"; } echo '<option value="0" ' . $selected . '>Ingen Hylle.</option>'; require ROOT . '../../koble_til_database.php'; $get_shelves = "SELECT * FROM lib_Shelf"; $get_shelves_qry = $conn->query($get_shelves); if ($get_shelves_qry->num_rows > 0) { while ($shelf = $get_shelves_qry->fetch_assoc()) { $selected = ''; if ($shelf['shelfID'] == $rfid[2]) { $selected = 'selected="selected"'; } echo '<option value="' . $shelf['shelfID'] . '" ' . $selected . '>' . $shelf['shelfNR'] . ' - ' . $shelf['name'] . '</option>'; } } echo '</select><input type="hidden" name="original" value="' . $rfid[0] . '" />'; echo '<input type="hidden" name="new" value="' . $rfid[0] . '" />'; echo ' <button>Oppdater</button></form></td>'; } echo '</tr>'; } echo '</table>'; } echo '<input type="button" onclick="window.location.href = \'' . URL_ROOT . 'rfid/create/' . $type . '/' . $info[$type . "ID"] . '\'" value="Legg til RFID">'; //Lended history if ($type == "book" || $type == "user") { echo '<h2>Lånehistorikk</h2>'; if (isset($info['lended']) && is_array($info['lended'])) { echo '<table cellspacing=0><tr><th>Bok RFID</th><th>Bruker ID</th><th>Bok ID</th><th>Utlånsdato</th><th>Innleveringsdato</th><th>Innleveringsfrist</th></tr>'; foreach ($info['lended'] as $lended) { echo '<tr>'; echo '<td><a href="' . URL_ROOT . 'info/books/' . $lended['bookID'] . '#' . $lended['bookRFID'] . '" class="' . $lended['bookRFID'] . '">' . $lended['bookRFID'] . '</a></td>'; echo '<td><a href="' . URL_ROOT . 'info/users/' . $lended['userID'] . '">' . $lended['userID'] . '</a></td>'; echo '<td><a href="' . URL_ROOT . 'info/books/' . $lended['bookID'] . '#' . $lended['bookRFID'] . '">' . $lended['bookID'] . '</a></td>'; echo '<td>' . $lended['outDate'] . '</td>'; echo '<td>' . $lended['inDate'] . '</td>'; echo '<td></td>'; echo '</tr> '; } echo '</table>'; } } //Button to delete echo '<h3>Slett</h3><input type="button" value="Slett" onclick="window.location.href = \'' . URL_ROOT . 'delete/' . $type . '/' . $info[$type . "ID"] . '\'">'; echo "</div>"; display_select_rfid_script(); display_rfid_script(); }
?> </b> users </li> <li> <b><?php echo get_total_quiz(); ?> </b> quizzes </li> <!--<li> <b><?php $day = floor((time() - strtotime($this->config->item('launch_date'))) / (60 * 60 * 24)); echo $day; ?> </b> day<?php echo get_plural($day); ?> since launch </li>--> <li>{elapsed_time}</li> <li>{memory_usage}</li> </ul> <?php } ?> <ul class="right"> <li> © <?php echo date('Y'); ?> <a href="/">OneExtraLap</a>