XOOPS  2.6.0
block.php
Go to the documentation of this file.
1 <?php
2 /*
3  You may not change or alter any portion of this comment or credits
4  of supporting developers from this source code or any supporting source code
5  which is considered copyrighted (c) material of the original comment or credit authors.
6 
7  This program is distributed in the hope that it will be useful,
8  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 */
11 
16 
28 class XoopsBlock extends XoopsObject
29 {
35  public function __construct($id = null)
36  {
37  $this->initVar('bid', XOBJ_DTYPE_INT, null, false);
38  $this->initVar('mid', XOBJ_DTYPE_INT, 0, false);
39  $this->initVar('func_num', XOBJ_DTYPE_INT, 0, false);
40  $this->initVar('options', XOBJ_DTYPE_TXTBOX, null, false, 255);
41  $this->initVar('name', XOBJ_DTYPE_TXTBOX, null, true, 150);
42  //$this->initVar('position', XOBJ_DTYPE_INT, 0, false);
43  $this->initVar('title', XOBJ_DTYPE_TXTBOX, null, false, 150);
44  $this->initVar('content', XOBJ_DTYPE_TXTAREA, null, false);
45  $this->initVar('side', XOBJ_DTYPE_INT, 0, false);
46  $this->initVar('weight', XOBJ_DTYPE_INT, 0, false);
47  $this->initVar('visible', XOBJ_DTYPE_INT, 0, false);
48  // The block_type is in a mess, let's say:
49  // S - generated by system module
50  // M - generated by a non-system module
51  // C - Custom block
52  // D - cloned system/module block
53  // E - cloned custom block, DON'T use it
54  $this->initVar('block_type', XOBJ_DTYPE_OTHER, null, false);
55  $this->initVar('c_type', XOBJ_DTYPE_OTHER, null, false);
56  $this->initVar('isactive', XOBJ_DTYPE_INT, null, false);
57  $this->initVar('dirname', XOBJ_DTYPE_TXTBOX, null, false, 50);
58  $this->initVar('func_file', XOBJ_DTYPE_TXTBOX, null, false, 50);
59  $this->initVar('show_func', XOBJ_DTYPE_TXTBOX, null, false, 50);
60  $this->initVar('edit_func', XOBJ_DTYPE_TXTBOX, null, false, 50);
61  $this->initVar('template', XOBJ_DTYPE_OTHER, null, false);
62  $this->initVar('bcachetime', XOBJ_DTYPE_INT, 0, false);
63  $this->initVar('last_modified', XOBJ_DTYPE_INT, 0, false);
64 
66 
67  // for backward compatibility
68  if (isset($id)) {
69  if (is_array($id)) {
70  $this->assignVars($id);
71  } else {
72  $blkhandler = $xoops->getHandlerBlock();
73  $obj = $blkhandler->get($id);
74  foreach (array_keys($obj->getVars()) as $i) {
75  $this->assignVar($i, $obj->getVar($i, 'n'));
76  }
77  }
78  }
79  $this->xoops_url = \XoopsBaseConfig::get('url');
80  $this->xoops_root_path = \XoopsBaseConfig::get('root-path');
81  }
82 
83 
88  public function id($format = 'n')
89  {
90  return $this->getVar('bid', $format);
91  }
92 
97  public function bid($format = '')
98  {
99  return $this->getVar('bid', $format);
100  }
101 
106  public function mid($format = '')
107  {
108  return $this->getVar('mid', $format);
109  }
110 
115  public function func_num($format = '')
116  {
117  return $this->getVar('func_num', $format);
118  }
119 
124  public function options($format = '')
125  {
126  return $this->getVar('options', $format);
127  }
128 
133  public function name($format = '')
134  {
135  return $this->getVar('name', $format);
136  }
137 
142  public function title($format = '')
143  {
144  return $this->getVar('title', $format);
145  }
146 
151  public function content($format = '')
152  {
153  return $this->getVar('content', $format);
154  }
155 
160  public function side($format = '')
161  {
162  return $this->getVar('side', $format);
163  }
164 
169  public function weight($format = '')
170  {
171  return $this->getVar('weight', $format);
172  }
173 
178  public function visible($format = '')
179  {
180  return $this->getVar('visible', $format);
181  }
182 
187  public function block_type($format = '')
188  {
189  return $this->getVar('block_type', $format);
190  }
191 
196  public function c_type($format = '')
197  {
198  return $this->getVar('c_type', $format);
199  }
200 
205  public function isactive($format = '')
206  {
207  return $this->getVar('isactive', $format);
208  }
209 
214  public function dirname($format = '')
215  {
216  return $this->getVar('dirname', $format);
217  }
218 
223  public function func_file($format = '')
224  {
225  return $this->getVar('func_file', $format);
226  }
227 
232  public function show_func($format = '')
233  {
234  return $this->getVar('show_func', $format);
235  }
236 
241  public function edit_func($format = '')
242  {
243  return $this->getVar('edit_func', $format);
244  }
245 
250  public function template($format = '')
251  {
252  return $this->getVar('template', $format);
253  }
254 
259  public function bcachetime($format = '')
260  {
261  return $this->getVar('bcachetime', $format);
262  }
263 
268  public function last_modified($format = '')
269  {
270  return $this->getVar('last_modified', $format);
271  }
272 
285  public function getContent($format = 's', $c_type = 'T')
286  {
287  $format = strtolower($format);
288  $c_type = strtoupper($c_type);
289  switch ($format) {
290  case 's':
291  // check the type of content
292  // H : custom HTML block
293  // P : custom PHP block
294  // S : use text sanitizater (smilies enabled)
295  // T : use text sanitizater (smilies disabled)
296  if ($c_type == 'H') {
297  return str_replace('{X_SITEURL}', $this->xoops_url . '/', $this->getVar('content', 'n'));
298  } else {
299  if ($c_type == 'P') {
300  ob_start();
301  echo eval($this->getVar('content', 'n'));
302  $content = ob_get_contents();
303  ob_end_clean();
304  return str_replace('{X_SITEURL}', $this->xoops_url . '/', $content);
305  } else {
306  if ($c_type == 'S') {
308  $content = str_replace('{X_SITEURL}', $this->xoops_url . '/', $this->getVar('content', 'n'));
309  return $myts->displayTarea($content, 1, 1);
310  } else {
312  $content = str_replace('{X_SITEURL}', \XoopsBaseConfig::get('url') . '/', $this->getVar('content', 'n'));
313  return $myts->displayTarea($content, 1, 0);
314  }
315  }
316  }
317  break;
318  case 'e':
319  return $this->getVar('content', 'e');
320  break;
321  default:
322  return $this->getVar('content', 'n');
323  break;
324  }
325  }
326 
332  public function getOptions()
333  {
335  if (!$this->isCustom()) {
336  $edit_func = (string)$this->getVar('edit_func');
337  if (!$edit_func) {
338  return false;
339  }
340  if (XoopsLoad::fileExists($this->xoops_root_path . '/modules/' . $this->getVar('dirname') . '/blocks/' . $this->getVar('func_file'))) {
341  $xoops->loadLanguage('blocks', $this->getVar('dirname'));
342  include_once $this->xoops_root_path . '/modules/' . $this->getVar('dirname') . '/blocks/' . $this->getVar('func_file');
343  if (function_exists($edit_func)) {
344  // execute the function
345  $options = explode('|', $this->getVar('options'));
346  $edit_form = $edit_func($options);
347  if (!$edit_form) {
348  return false;
349  }
350  } else {
351  return false;
352  }
353  return $edit_form;
354  } else {
355  return false;
356  }
357  } else {
358  return false;
359  }
360  }
361 
362  public function isCustom()
363  {
364  return in_array($this->getVar("block_type"), array('C', 'E'));
365  }
366 
367  /************ADDED**************/
368 
369 
375  public function buildBlock()
376  {
378  $block = array();
379  if (!$this->isCustom()) {
380  // get block display function
381  $show_func = (string)$this->getVar('show_func');
382  if (!$show_func) {
383  return false;
384  }
385  if (!XoopsLoad::fileExists($func_file = $xoops->path('modules/' . $this->getVar('dirname') . '/blocks/' . $this->getVar('func_file')))) {
386  return false;
387  }
388  // must get lang files b4 including the file
389  // some modules require it for code that is outside the function
390  $xoops->loadLanguage('blocks', $this->getVar('dirname'));
391  $xoops->loadLocale($this->getVar('dirname'));
392  include_once $func_file;
393 
394  if (function_exists($show_func)) {
395  // execute the function
396  $options = explode('|', $this->getVar('options'));
397  $block = $show_func($options);
398  if (!$block) {
399  return false;
400  }
401  } else {
402  return false;
403  }
404  } else {
405  // it is a custom block, so just return the contents
406  $block['content'] = $this->getContent('s', $this->getVar('c_type'));
407  if (empty($block['content'])) {
408  return false;
409  }
410  }
411  return $block;
412  }
413 }
414 
416 {
422  public function __construct(Connection $db = null)
423  {
424  parent::__construct($db, 'newblocks', 'XoopsBlock', 'bid', 'name');
425  }
426 
432  public function insertBlock(XoopsBlock &$obj, $force = false)
433  {
434  $obj->setVar('last_modified', time());
435  return parent::insert($obj, $force);
436  }
437 
444  public function deleteBlock(XoopsBlock &$obj)
445  {
446  if (!parent::delete($obj)) {
447  return false;
448  }
449  $qb = $this->db2->createXoopsQueryBuilder();
450  $eb = $qb->expr();
451  $qb ->deletePrefix('group_permission', null)
452  ->where($eb->eq('gperm_name', $eb->literal('block_read')))
453  ->andWhere($eb->eq('gperm_itemid', $qb->createNamedParameter($obj->getVar('bid'), \PDO::PARAM_INT)))
454  ->andWhere($eb->eq('gperm_modid', $qb->createNamedParameter(1, \PDO::PARAM_INT)))
455  ->execute();
456 
457  $qb ->deletePrefix('block_module_link', null)
458  ->where($eb->eq('block_id', $qb->createNamedParameter($obj->getVar('bid'), \PDO::PARAM_INT)))
459  ->execute();
460 
461  return true;
462  }
463 
470  public function getDistinctObjects(CriteriaElement $criteria = null, $id_as_key = false)
471  {
472  $ret = array();
473 
474  $qb = $this->db2->createXoopsQueryBuilder();
475  $eb = $qb->expr();
476  $qb ->select('DISTINCT(b.bid)')
477  ->addSelect('b.*')
478  ->fromPrefix('newblocks', 'b')
479  ->leftJoinPrefix('b', 'block_module_link', 'l', $eb->eq('b.bid', 'l.block_id'));
480 
481  if (isset($criteria) && ($criteria instanceof CriteriaElement)) {
482  $criteria->renderQb($qb);
483  }
484 
485  $result = $qb->execute();
486  if (!$result) {
487  return $ret;
488  }
489  while ($myrow = $result->fetch(\PDO::FETCH_ASSOC)) {
490  $block = new XoopsBlock();
491  $block->assignVars($myrow);
492  if (!$id_as_key) {
493  $ret[] = $block;
494  } else {
495  $ret[$myrow['bid']] = $block;
496  }
497  unset($block);
498  }
499  return $ret;
500 
501  }
502 
509  public function getNameList(CriteriaElement $criteria = null)
510  {
511  $blocks = $this->getObjects($criteria, true);
512  $ret = array();
513  foreach (array_keys($blocks) as $i) {
514  $name = (!$blocks[$i]->isCustom()) ? $blocks[$i]->getVar('name') : $blocks[$i]->getVar('title');
515  $ret[$i] = $name;
516  }
517  return $ret;
518  }
519 
537  public function getAllBlocksByGroup($groupid, $asobject = true, $side = null, $visible = null, $orderby = "b.weight,b.bid", $isactive = 1)
538  {
539  $ret = array();
540  $qb = $this->db2->createXoopsQueryBuilder();
541  $eb = $qb->expr();
542  if ($asobject) {
543  $qb ->select('b.*');
544  } else {
545  $qb ->select('b.bid');
546  }
547  $qb ->fromPrefix('newblocks', 'b')
548  ->leftJoinPrefix('b', 'group_permission', 'l', $eb->eq('b.bid', 'l.gperm_itemid'))
549  ->where($eb->eq('gperm_name', $eb->literal('block_read')))
550  ->andWhere($eb->eq('gperm_modid', 1));
551 
552  if (is_array($groupid)) {
553  if (count($groupid) > 1) {
554  $in=array();
555  foreach ($groupid as $gid) {
556  $in[] = $qb->createNamedParameter($gid, \PDO::PARAM_INT);
557  }
558  $qb->andWhere($eb->in('l.gperm_groupid', $in));
559  }
560  } else {
561  $qb->andWhere($eb->eq('l.gperm_groupid', $qb->createNamedParameter($groupid, \PDO::PARAM_INT)));
562  }
563  $qb->andWhere($eb->eq('b.isactive', $qb->createNamedParameter($isactive, \PDO::PARAM_INT)));
564  if (isset($side)) {
565  // get both sides in sidebox? (some themes need this)
566  if ($side == XOOPS_SIDEBLOCK_BOTH) {
567  $qb->andWhere($eb->in('b.side', array(0,1)));
568  } elseif ($side == XOOPS_CENTERBLOCK_ALL) {
569  $qb->andWhere($eb->in('b.side', array(3,4,5,7,8,9)));
570  } else {
571  $qb->andWhere($eb->eq('b.side', $qb->createNamedParameter($side, \PDO::PARAM_INT)));
572  }
573  }
574  if (isset($visible)) {
575  $qb->andWhere($eb->eq('b.visible', $qb->createNamedParameter($visible, \PDO::PARAM_INT)));
576  }
577  $qb->orderBy($orderby);
578  $result = $qb->execute();
579  $added = array();
580  while ($myrow = $result->fetch(\PDO::FETCH_ASSOC)) {
581  if (!in_array($myrow['bid'], $added)) {
582  if (!$asobject) {
583  $ret[] = $myrow['bid'];
584  } else {
585  $ret[] = new XoopsBlock($myrow);
586  }
587  array_push($added, $myrow['bid']);
588  }
589  }
590  return $ret;
591  }
592 
601  public function getAllBlocks($rettype = "object", $side = null, $visible = null, $orderby = "side,weight,bid", $isactive = 1)
602  {
603  $ret = array();
604  $qb = $this->db2->createXoopsQueryBuilder();
605  $eb = $qb->expr();
606 
607  $qb ->fromPrefix('newblocks', null)
608  ->where($eb->eq('isactive', $qb->createNamedParameter($isactive, \PDO::PARAM_INT)));
609  if (isset($side)) {
610  // get both sides in sidebox? (some themes need this)
611  if ($side == XOOPS_SIDEBLOCK_BOTH) {
612  $qb->andWhere($eb->in('side', array(0,1)));
613  } elseif ($side == XOOPS_CENTERBLOCK_ALL) {
614  $qb->andWhere($eb->in('side', array(3,4,5,7,8,9)));
615  } else {
616  $qb->andWhere($eb->eq('side', $qb->createNamedParameter($side, \PDO::PARAM_INT)));
617  }
618  }
619  if (isset($visible)) {
620  $qb->andWhere($eb->eq('visible', $qb->createNamedParameter($visible, \PDO::PARAM_INT)));
621  }
622  $qb->orderBy($orderby);
623  switch ($rettype) {
624  case "object":
625  $qb->select('*');
626  $result = $qb->execute();
627  while ($myrow = $result->fetch(\PDO::FETCH_ASSOC)) {
628  $ret[] = new XoopsBlock($myrow);
629  }
630  break;
631  case "list":
632  $qb->select('*');
633  $result = $qb->execute();
634  while ($myrow = $result->fetch(\PDO::FETCH_ASSOC)) {
635  $block = new XoopsBlock($myrow);
636  $title = $block->getVar("title");
637  $title = empty($title) ? $block->getVar("name") : $title;
638  $ret[$block->getVar("bid")] = $title;
639  }
640  break;
641  case "id":
642  $qb->select('bid');
643  $result = $qb->execute();
644  while ($myrow = $result->fetch(\PDO::FETCH_ASSOC)) {
645  $ret[] = $myrow['bid'];
646  }
647  break;
648  }
649 
650  return $ret;
651  }
652 
658  public function getByModule($moduleid, $asobject = true)
659  {
660  $qb = $this->db2->createXoopsQueryBuilder();
661  $eb = $qb->expr();
662 
663  $qb ->fromPrefix('newblocks', null)
664  ->where($eb->eq('mid', $qb->createNamedParameter($moduleid, \PDO::PARAM_INT)));
665  if ($asobject == true) {
666  $qb->select('*');
667  } else {
668  $qb->select('bid');
669  }
670 
671  $ret = array();
672  $result = $qb->execute();
673  while ($myrow = $result->fetch(\PDO::FETCH_ASSOC)) {
674  if ($asobject) {
675  $ret[] = new XoopsBlock($myrow);
676  } else {
677  $ret[] = $myrow['bid'];
678  }
679  }
680  return $ret;
681  }
682 
694  public function getAllByGroupModule(
695  $groupid,
696  $module_id = 0,
697  $toponlyblock = false,
698  $visible = null,
699  $orderby = 'b.weight, m.block_id',
700  $isactive = 1
701  ) {
702  $ret = array();
703 
704  $qb = $this->db2->createXoopsQueryBuilder();
705  $eb = $qb->expr();
706 
707  $blockids=null;
708  if (isset($groupid)) {
709  $qb ->select('DISTINCT gperm_itemid')
710  ->fromPrefix('group_permission', null)
711  ->where($eb->eq('gperm_name', $eb->literal('block_read')))
712  ->andWhere('gperm_modid=1');
713 
714  if (is_array($groupid) AND !empty($groupid)) {
715  $qb->andWhere($eb->in('gperm_groupid', $groupid));
716  } else {
717  if (intval($groupid) > 0) {
718  $qb->andWhere($eb->eq('gperm_groupid', $groupid));
719  }
720  }
721  $result = $qb->execute();
722  $blockids = $result->fetchAll(\PDO::FETCH_COLUMN, 0);
723  }
724 
725  $qb->resetQueryParts();
726 
727  $qb ->select('b.*')
728  ->fromPrefix('newblocks', 'b')
729  ->where($eb->eq('b.isactive', $qb->createNamedParameter($isactive, \PDO::PARAM_INT)));
730  if (isset($visible)) {
731  $qb->andWhere($eb->eq('b.visible', $qb->createNamedParameter($visible, \PDO::PARAM_INT)));
732  }
733  if (isset($module_id)) {
734  $qb ->fromPrefix('block_module_link', 'm')
735  ->andWhere($eb->eq('m.block_id', 'b.bid'));
736  if (!empty($module_id)) {
737  $in=array();
738  $in[]=0;
739  $in[]=intval($module_id);
740  if ($toponlyblock) {
741  $in[]=intval(-1);
742  }
743  } else {
744  if ($toponlyblock) {
745  $in=array(0, -1);
746  } else {
747  $in=0;
748  }
749  }
750  if (is_array($in)) {
751  $qb->andWhere($eb->in('m.module_id', $in));
752  } else {
753  $qb->andWhere($eb->eq('m.module_id', $in));
754  }
755  }
756  if (!empty($blockids)) {
757  $qb->andWhere($eb->in('b.bid', $blockids));
758  }
759  $qb->orderBy($orderby);
760  $result = $qb->execute();
761  while ($myrow = $result->fetch(\PDO::FETCH_ASSOC)) {
762  $block = new XoopsBlock($myrow);
763  $ret[$myrow['bid']] = $block;
764  unset($block);
765  }
766  return $ret;
767  }
768 
779  public function getNonGroupedBlocks($module_id = 0, $toponlyblock = false, $visible = null, $orderby = 'b.weight, m.block_id', $isactive = 1)
780  {
781  $ret = array();
782 
783  $qb = $this->db2->createXoopsQueryBuilder();
784  $eb = $qb->expr();
785 
786  $qb ->select('DISTINCT(bid)')
787  ->fromPrefix('newblocks', null);
788  $result = $qb->execute();
789  $bids = $result->fetchAll(\PDO::FETCH_COLUMN, 0);
790 
791  $qb->resetQueryParts();
792 
793  $qb ->select('DISTINCT(p.gperm_itemid)')
794  ->fromPrefix('group_permission', 'p')
795  ->fromPrefix('groups', 'g')
796  ->where($eb->eq('g.groupid', 'p.gperm_groupid'))
797  ->andWhere($eb->eq('p.gperm_name', $eb->literal('block_read')));
798  $result = $qb->execute();
799  $grouped = $result->fetchAll(\PDO::FETCH_COLUMN, 0);
800 
801  $non_grouped = array_diff($bids, $grouped);
802 
803  if (!empty($non_grouped)) {
804  $qb->resetQueryParts();
805 
806  $qb ->select('b.*')
807  ->fromPrefix('newblocks', 'b')
808  ->where($eb->eq('b.isactive', $qb->createNamedParameter($isactive, \PDO::PARAM_INT)));
809  if (isset($visible)) {
810  $qb->andWhere($eb->eq('b.visible', $qb->createNamedParameter($visible, \PDO::PARAM_INT)));
811  }
812 
813  $sql = 'SELECT b.* FROM ' . $this->db2->prefix('newblocks') . ' b, '
814  . $this->db2->prefix('block_module_link') . ' m';
815  $sql .= ' WHERE b.isactive=' . intval($isactive);
816  if (isset($visible)) {
817  $sql .= ' AND b.visible=' . intval($visible);
818  }
819  if (isset($module_id)) {
820  $qb ->fromPrefix('block_module_link', 'm')
821  ->andWhere($eb->eq('m.block_id', 'b.bid'));
822  if (!empty($module_id)) {
823  $in=array();
824  $in[]=0;
825  $in[]=intval($module_id);
826  if ($toponlyblock) {
827  $in[]=intval(-1);
828  }
829  } else {
830  if ($toponlyblock) {
831  $in=array(0, -1);
832  } else {
833  $in=0;
834  }
835  }
836  if (is_array($in)) {
837  $qb->andWhere($eb->in('m.module_id', $in));
838  } else {
839  $qb->andWhere($eb->eq('m.module_id', $in));
840  }
841  }
842  $qb->andWhere($eb->in('b.bid', $non_grouped));
843  $qb->orderBy($orderby);
844  $result = $qb->execute();
845  while ($myrow = $result->fetch(\PDO::FETCH_ASSOC)) {
846  $block = new XoopsBlock($myrow);
847  $ret[$myrow['bid']] = $block;
848  unset($block);
849  }
850  }
851  return $ret;
852  }
853 
862  public function countSimilarBlocks($moduleId, $funcNum, $showFunc = null)
863  {
864  $funcNum = intval($funcNum);
865  $moduleId = intval($moduleId);
866  if ($funcNum < 1 || $moduleId < 1) {
867  // invalid query
868  return 0;
869  }
870 
871  $qb = $this->db2->createXoopsQueryBuilder();
872  $eb = $qb->expr();
873 
874  $qb ->select('COUNT(*)')
875  ->fromPrefix('newblocks', null)
876  ->where($eb->eq('mid', $qb->createNamedParameter($moduleId, \PDO::PARAM_INT)))
877  ->andWhere($eb->eq('func_num', $qb->createNamedParameter($funcNum, \PDO::PARAM_INT)));
878 
879  if (isset($showFunc)) {
880  // showFunc is set for more strict comparison
881  $qb->andWhere($eb->eq('show_func', $qb->createNamedParameter($showFunc, \PDO::PARAM_STR)));
882  }
883  if (!$result = $qb->execute()) {
884  return 0;
885  }
886  list ($count) = $result->fetch(\PDO::FETCH_NUM);
887  return $count;
888  }
889 
902  public function buildContent($position, $content = "", $contentdb = "")
903  {
904  $ret = '';
905  if ($position == 0) {
906  $ret = $contentdb . $content;
907  } else {
908  if ($position == 1) {
909  $ret = $content . $contentdb;
910  }
911  }
912  return $ret;
913  }
914 
922  public function buildTitle($originaltitle, $newtitle = '')
923  {
924  if ($newtitle != '') {
925  $ret = $newtitle;
926  } else {
927  $ret = $originaltitle;
928  }
929  return $ret;
930  }
931 
932  /************ system ***************/
933 
938  public function getBlockByPerm($groupid)
939  {
940  $ret = array();
941  if (isset($groupid)) {
942  $qb = $this->db2->createXoopsQueryBuilder();
943  $eb = $qb->expr();
944 
945  $qb ->select('DISTINCT(gperm_itemid)')
946  ->fromPrefix('group_permission', 'p')
947  ->fromPrefix('groups', 'g')
948  ->where($eb->eq('p.gperm_name', $eb->literal('block_read')))
949  ->andWhere('gperm_modid=1');
950 
951  if (is_array($groupid)) {
952  $qb->andWhere($eb->in('gperm_groupid', $groupid));
953  } else {
954  if (intval($groupid) > 0) {
955  $qb->andWhere($eb->eq('gperm_groupid', $groupid));
956  }
957  }
958 
959  $result = $qb->execute();
960  $blockids = $result->fetchAll(\PDO::FETCH_COLUMN, 0);
961  return $blockids;
962  }
963  return $ret;
964  }
965 }
getByModule($moduleid, $asobject=true)
Definition: block.php:658
getNameList(CriteriaElement $criteria=null)
Definition: block.php:509
func_file($format= '')
Definition: block.php:223
$i
Definition: dialog.php:68
buildTitle($originaltitle, $newtitle= '')
Definition: block.php:922
getNonGroupedBlocks($module_id=0, $toponlyblock=false, $visible=null, $orderby= 'b.weight, m.block_id', $isactive=1)
Definition: block.php:779
static getInstance()
Definition: Xoops.php:160
__construct($id=null)
Definition: block.php:35
$module_id
Definition: update.php:56
$options['editor']
$result
Definition: pda.php:33
getContent($format= 's', $c_type= 'T')
Definition: block.php:285
id($format= 'n')
Definition: block.php:88
getAllByGroupModule($groupid, $module_id=0, $toponlyblock=false, $visible=null, $orderby= 'b.weight, m.block_id', $isactive=1)
Definition: block.php:694
block_type($format= '')
Definition: block.php:187
getAllBlocksByGroup($groupid, $asobject=true, $side=null, $visible=null, $orderby="b.weight,b.bid", $isactive=1)
Definition: block.php:537
weight($format= '')
Definition: block.php:169
countSimilarBlocks($moduleId, $funcNum, $showFunc=null)
Definition: block.php:862
show_func($format= '')
Definition: block.php:232
__construct(Connection $db=null)
Definition: block.php:422
getVar($key, $format= 's')
bid($format= '')
Definition: block.php:97
$visible
Definition: admin_menu.php:39
func_num($format= '')
Definition: block.php:115
$xoops
Definition: admin.php:25
$id
Definition: admin_menu.php:36
isCustom()
Definition: block.php:362
buildContent($position, $content="", $contentdb="")
Definition: block.php:902
c_type($format= '')
Definition: block.php:196
title($format= '')
Definition: block.php:142
static fileExists($file)
Definition: xoopsload.php:506
edit_func($format= '')
Definition: block.php:241
dirname($format= '')
Definition: block.php:214
insertBlock(XoopsBlock &$obj, $force=false)
Definition: block.php:432
const XOBJ_DTYPE_TXTAREA
Definition: XoopsObject.php:21
side($format= '')
Definition: block.php:160
static get($name)
getDistinctObjects(CriteriaElement $criteria=null, $id_as_key=false)
Definition: block.php:470
buildBlock()
Definition: block.php:375
$sql
Definition: pda.php:32
mid($format= '')
Definition: block.php:106
last_modified($format= '')
Definition: block.php:268
getBlockByPerm($groupid)
Definition: block.php:938
bcachetime($format= '')
Definition: block.php:259
$criteria
getOptions()
Definition: block.php:332
deleteBlock(XoopsBlock &$obj)
Definition: block.php:444
const XOOPS_CENTERBLOCK_ALL
Definition: defines.php:28
$myts
Definition: edituser.php:38
setVar($key, $value, $not_gpc=false)
initVar($key, $data_type, $value=null, $required=false, $maxlength=null, $options= '')
options($format= '')
Definition: block.php:124
content($format= '')
Definition: block.php:151
getAllBlocks($rettype="object", $side=null, $visible=null, $orderby="side,weight,bid", $isactive=1)
Definition: block.php:601
const XOOPS_SIDEBLOCK_BOTH
Definition: defines.php:24
name($format= '')
Definition: block.php:133
visible($format= '')
Definition: block.php:178
isactive($format= '')
Definition: block.php:205