当前位置: 首页>>代码示例>>PHP>>正文


PHP XoopsBlock::assignVars方法代码示例

本文整理汇总了PHP中XoopsBlock::assignVars方法的典型用法代码示例。如果您正苦于以下问题:PHP XoopsBlock::assignVars方法的具体用法?PHP XoopsBlock::assignVars怎么用?PHP XoopsBlock::assignVars使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XoopsBlock的用法示例。


在下文中一共展示了XoopsBlock::assignVars方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: XoopsBlock

 /**
  * retrieve a specific {@link XoopsBlock}
  *
  * @see XoopsBlock
  * @param int $id bid of the block to retrieve
  * @return object XoopsBlock reference to the block
  **/
 function &get($id)
 {
     $id = (int) $id;
     if ($id > 0) {
         $sql = 'SELECT * FROM ' . $this->db->prefix('newblocks') . ' WHERE bid=' . $id;
         if (!($result = $this->db->query($sql))) {
             $ret = false;
             //< You may think this should be null. But this is the compatibility with X2.
             return $ret;
         }
         $numrows = $this->db->getRowsNum($result);
         if ($numrows == 1) {
             $block = new XoopsBlock();
             $block->assignVars($this->db->fetchArray($result));
             return $block;
         }
     }
     $ret = false;
     //< You may think this should be null. But this is the compatibility with X2.
     return $ret;
 }
开发者ID:nouphet,项目名称:rata,代码行数:28,代码来源:block.php

示例2: getObjects

 /**
  * retrieve array of {@link XoopsBlock}s meeting certain conditions
  * @param  CriteriaElement $criteria  {@link CriteriaElement} with conditions for the blocks
  * @param  bool   $id_as_key should the blocks' bid be the key for the returned array?
  * @return array  {@link XoopsBlock}s matching the conditions
  **/
 public function getObjects(CriteriaElement $criteria = null, $id_as_key = false)
 {
     $ret = array();
     $limit = $start = 0;
     $sql = 'SELECT DISTINCT(b.bid), b.* FROM ' . $this->db->prefix('newblocks') . ' b LEFT JOIN ' . $this->db->prefix('block_module_link') . ' l ON b.bid=l.block_id';
     if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
         $sql .= ' ' . $criteria->renderWhere();
         $limit = $criteria->getLimit();
         $start = $criteria->getStart();
     }
     $result = $this->db->query($sql, $limit, $start);
     if (!$result) {
         return $ret;
     }
     while ($myrow = $this->db->fetchArray($result)) {
         $block = new XoopsBlock();
         $block->assignVars($myrow);
         if (!$id_as_key) {
             $ret[] =& $block;
         } else {
             $ret[$myrow['bid']] =& $block;
         }
         unset($block);
     }
     return $ret;
 }
开发者ID:geekwright,项目名称:XoopsCore25,代码行数:32,代码来源:block.php

示例3: getDistinctObjects

 /**
  * retrieve array of {@link XoopsBlock}s meeting certain conditions
  * @param CriteriaElement|null $criteria {@link CriteriaElement} with conditions for the blocks
  * @param bool $id_as_key should the blocks' bid be the key for the returned array?
  * @return array {@link XoopsBlock}s matching the conditions
  **/
 public function getDistinctObjects(CriteriaElement $criteria = null, $id_as_key = false)
 {
     $ret = array();
     $qb = $this->db2->createXoopsQueryBuilder();
     $eb = $qb->expr();
     $qb->select('DISTINCT(b.bid)')->addSelect('b.*')->fromPrefix('newblocks', 'b')->leftJoinPrefix('b', 'block_module_link', 'l', $eb->eq('b.bid', 'l.block_id'));
     if (isset($criteria) && $criteria instanceof CriteriaElement) {
         $criteria->renderQb($qb);
     }
     $result = $qb->execute();
     if (!$result) {
         return $ret;
     }
     while ($myrow = $result->fetch(\PDO::FETCH_ASSOC)) {
         $block = new XoopsBlock();
         $block->assignVars($myrow);
         if (!$id_as_key) {
             $ret[] = $block;
         } else {
             $ret[$myrow['bid']] = $block;
         }
         unset($block);
     }
     return $ret;
 }
开发者ID:RanLee,项目名称:XoopsCore,代码行数:31,代码来源:block.php


注:本文中的XoopsBlock::assignVars方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。