XOOPS RMCommon Utilities  2.1.8.91RC
 All Classes Namespaces Files Functions Variables
cachemod.class.php
Go to the documentation of this file.
1 <?php
2 // $Id: cachemod.class.php 825 2011-12-09 00:06:11Z i.bitcero $
3 // --------------------------------------------------------------
4 // Red México Common Utilities
5 // A framework for Red México Modules
6 // Author: Eduardo Cortés <i.bitcero@gmail.com>
7 // Email: i.bitcero@gmail.com
8 // License: GPL 2.0
9 // --------------------------------------------------------------
10 
12 {
13  private $selected = array();
14 
15  public function __construct($caption, $name, $selected=null){
16  $this->setName($name);
17  $this->setCaption($caption);
18  $this->selected = $selected;
19  }
20 
21  public function render(){
22  $module_handler =& xoops_gethandler('application');
23  $modules =& $module_handler->getObjects(new Criteria('hasmain', 1), true);
24  $options = array('0' => _NOCACHE, '30' => sprintf(_SECONDS, 30), '60' => _MINUTE, '300' => sprintf(_MINUTES, 5), '1800' => sprintf(_MINUTES, 30), '3600' => _HOUR, '18000' => sprintf(_HOURS, 5), '86400' => _DAY, '259200' => sprintf(_DAYS, 3), '604800' => _WEEK);
25 
26  $rtn = "<table cellpadding='2' cellspacing='1' border='0'>";
27  if (count($modules) > 0) {
28  foreach ($modules as $mod) {
29  $rtn .= "<tr><td>".$mod->getVar('name')."</td><td>
30  <select name='".$this->getName()."[".$mod->getVar('mid')."]' id='".$this->id()."'>";
31  foreach ($options as $k => $v){
32  $rtn .= "<option value='$k'";
33  $rtn .= isset($this->selected[$mod->getVar('mid')]) && $this->selected[$mod->getVar('mid')]==$k ? " selected='selected'" : "";
34  $rtn .= ">$v</option>";
35  }
36  $rtn .= "</td></tr>";
37  /*$c_val = isset($currrent_val[$mid]) ? intval($currrent_val[$mid]) : null;
38  $selform = new XoopsFormSelect($modules[$mid]->getVar('name'), $config[$i]->getVar('conf_name')."[$mid]", $c_val);
39  $selform->addOptionArray($cache_options);
40  $ele->addElement($selform);
41  unset($selform);*/
42  }
43  } else {
44  $rtn .= "<tr><td>"._AS_SYSPREF_NOMODS."</td></tr>";
45  }
46 
47  $rtn .= "</table>";
48 
49  return $rtn;
50  }
51 
52 }