85 if (!isset($this->modinfo)) {
88 $this->
setVar(
'name', $this->modinfo[
'name'],
true);
89 $this->
setVar(
'version', intval(100 * ($this->modinfo[
'version'] + 0.001)),
true);
90 $this->
setVar(
'dirname', $this->modinfo[
'dirname'],
true);
91 $hasmain = (isset($this->modinfo[
'hasMain']) && $this->modinfo[
'hasMain'] == 1) ? 1 : 0;
92 $hasadmin = (isset($this->modinfo[
'hasAdmin']) && $this->modinfo[
'hasAdmin'] == 1) ? 1 : 0;
93 $hassearch = (isset($this->modinfo[
'hasSearch']) && $this->modinfo[
'hasSearch'] == 1) ? 1 : 0;
94 $hasconfig = ((isset($this->modinfo[
'config']) && is_array($this->modinfo[
'config'])) || ! empty($this->modinfo[
'hasComments'])) ? 1 : 0;
95 $hascomments = (isset($this->modinfo[
'hasComments']) && $this->modinfo[
'hasComments'] == 1) ? 1 : 0;
97 $hasnotification = (isset($this->modinfo[
'hasNotification']) && $this->modinfo[
'hasNotification'] == 1) ? 1 : 0;
98 $this->
setVar(
'hasmain', $hasmain);
99 $this->
setVar(
'hasadmin', $hasadmin);
100 $this->
setVar(
'hassearch', $hassearch);
101 $this->
setVar(
'hasconfig', $hasconfig);
102 $this->
setVar(
'hascomments', $hascomments);
104 $this->
setVar(
'hasnotification', $hasnotification);
115 $this->_msg[] = trim($str);
139 $this->modinfo = $value;
141 $this->modinfo[
$name] = $value;
155 if (!isset($this->modinfo)) {
159 if (isset($this->modinfo[
$name])) {
160 return $this->modinfo[
$name];
175 if ($this->
getVar(
'hasmain') == 1) {
176 $ret =
'<a href="' . $this->xoops_url .
'/modules/' . $this->
getVar(
'dirname') .
'/">' . $this->
getVar(
'name') .
'</a>';
191 foreach ($this->
getInfo(
'sub') as $submenu) {
193 'name' => $submenu[
'name'] ,
194 'url' => $submenu[
'url']);
205 $file = $this->xoops_root_path .
'/modules/' . $this->
getInfo(
'dirname') .
'/' . $this->
getInfo(
'adminmenu');
220 if (!isset($this->adminmenu)) {
243 if (isset($modVersions[
$dirname])) {
244 $this->modinfo = $modVersions[
$dirname];
247 $xoops = xoops::getInstance();
248 $dirname = basename($dirname);
249 $xoops->loadLanguage(
'modinfo', $dirname);
250 $xoops->loadLocale($dirname);
253 if (
false != $verbose) {
254 echo
"Module File for $dirname Not Found!";
261 $this->modinfo = $modVersions[
$dirname];
286 public function id($format =
'n')
288 return $this->
getVar(
'mid', $format);
295 public function mid($format =
'')
297 return $this->
getVar(
'mid', $format);
304 public function name($format =
'')
306 return $this->
getVar(
'name', $format);
315 return $this->
getVar(
'version', $format);
324 return $this->
getVar(
'last_update', $format);
333 return $this->
getVar(
'weight', $format);
342 return $this->
getVar(
'isactive', $format);
351 return $this->
getVar(
'dirname', $format);
360 return $this->
getVar(
'hasmain', $format);
369 return $this->
getVar(
'hasadmin', $format);
378 return $this->
getVar(
'hassearch', $format);
387 return $this->
getVar(
'hasconfig', $format);
396 return $this->
getVar(
'hascomments', $format);
405 return $this->
getVar(
'hasnotification', $format);
453 parent::__construct($db,
'modules',
'XoopsModule',
'mid',
'dirname');
466 if (!empty($this->_cachedModule_mid[
$id])) {
467 return $this->_cachedModule_mid[
$id];
474 $this->_cachedModule_dirname[
$module->getVar(
'dirname')] =
$module;
492 if (!empty($this->_cachedModule_dirname[
$dirname])) {
493 return $this->_cachedModule_dirname[
$dirname];
518 if (!parent::insert($module)) {
525 if (!empty($this->_cachedModule_dirname[
$dirname])) {
526 unset($this->_cachedModule_dirname[$dirname]);
528 if (!empty($this->_cachedModule_mid[
$mid])) {
529 unset($this->_cachedModule_mid[$mid]);
542 if (!parent::delete($module)) {
550 $qb = $this->db2->createXoopsQueryBuilder();
552 $qb ->deletePrefix(
'group_permission')
555 $eb->eq(
'gperm_name', $eb->literal(
'module_admin')),
556 $eb->eq(
'gperm_name', $eb->literal(
'module_read'))
559 ->andWhere($eb->eq(
'gperm_itemid',
':itemid'))
560 ->setParameter(
':itemid',
$mid, \PDO::PARAM_INT);
563 $qb->resetQueryParts();
564 $qb ->select(
'block_id')
565 ->fromPrefix(
'block_module_link', null)
566 ->where($eb->eq(
'module_id',
':mid'))
567 ->setParameter(
':mid',
$mid, \PDO::PARAM_INT);
569 $block_id_arr = array();
570 while ($myrow =
$result->fetch(PDO::FETCH_ASSOC)) {
571 array_push($block_id_arr, $myrow[
'block_id']);
574 foreach ($block_id_arr as
$i) {
575 $qb->resetQueryParts();
576 $qb ->select(
'COUNT(*)')
577 ->fromPrefix(
'block_module_link', null)
578 ->where($eb->ne(
'module_id',
':mid'))
579 ->setParameter(
':mid',
$mid, \PDO::PARAM_INT)
580 ->andWhere($eb->eq(
'block_id',
':bid'))
581 ->setParameter(
':bid', $i, \PDO::PARAM_INT);
587 $qb->resetQueryParts();
588 $qb ->deletePrefix(
'block_module_link')
589 ->where($eb->eq(
'module_id',
':mid'))
590 ->setParameter(
':mid',
$mid, \PDO::PARAM_INT)
591 ->andWhere($eb->eq(
'block_id',
':bid'))
592 ->setParameter(
':bid', $i, \PDO::PARAM_INT)
596 $qb->resetQueryParts();
597 $qb ->updatePrefix(
'newblocks')
598 ->set(
'visible',
':notvisible')
599 ->where($eb->eq(
'bid',
':bid'))
600 ->setParameter(
':bid', $i, \PDO::PARAM_INT)
601 ->setParameter(
':notvisible', 0, \PDO::PARAM_INT)
604 $qb->resetQueryParts();
605 $qb ->updatePrefix(
'block_module_link')
606 ->set(
'module_id',
':nomid')
607 ->where($eb->eq(
'module_id',
':mid'))
608 ->setParameter(
':mid',
$mid, \PDO::PARAM_INT)
609 ->setParameter(
':nomid', -1, \PDO::PARAM_INT)
614 if (!empty($this->_cachedModule_dirname[
$dirname])) {
615 unset($this->_cachedModule_dirname[$dirname]);
617 if (!empty($this->_cachedModule_mid[
$mid])) {
618 unset($this->_cachedModule_mid[$mid]);
621 $cache->delete(
"system/module/id/{$mid}");
622 $cache->delete(
"system/module/dirname/{$dirname}");
623 $cache->delete(
"module/{$dirname}");
638 $qb = $this->db2->createXoopsQueryBuilder();
639 $qb->select(
'*')->fromPrefix(
'modules', null);
643 $qb->addOrderBy(
'mid',
'ASC');
646 if (!
$result = $qb->execute()) {
649 }
catch (Exception $e) {
652 while ($myrow =
$result->fetch(PDO::FETCH_ASSOC)) {
679 if (!$dirname_as_key) {
682 $ret[
$modules[
$i]->getVar(
'dirname')] = $modules[
$i]->getVar(
'name');
getNameList(CriteriaElement $criteria=null, $dirname_as_key=false)
deleteModule(XoopsModule &$module)
insertModule(XoopsModule &$module)
loadInfo($dirname, $verbose=true)
if(!isset($xoops->paths[$path_type])) if($path_type== 'var') $file
search($term= '', $andor= 'AND', $limit=0, $offset=0, $userid=0)
getVar($key, $format= 's')
loadInfoAsVar($dirname, $verbose=true)
getObjectsArray(CriteriaElement $criteria=null, $id_as_key=false)
__construct(Connection $db=null)
setVar($key, $value, $not_gpc=false)
initVar($key, $data_type, $value=null, $required=false, $maxlength=null, $options= '')
hasnotification($format= '')