/** * 获取作者 * @return mixed */ public function getAuthor() { $Db = parent::getDb(); $member = $Db->table('member_info')->getAll()->order('id')->done(); foreach ($member as $k => $v) { $res[$v['id']] = $v['nickname']; } return $res; }
/** * 获取栏目序列,因为路由信息是与栏目菜单存在关联,在有些地方 如注册,登陆,这些可能不需要栏目数据,所以独立出来 */ public function getSequence() { $db = parent::getDb(); //获取菜单数据 $Menu = $db->table('common_menu')->getAll(array('is_admin' => 0, 'is_display' => 1))->order('parent_id')->done(); //排序 foreach ($Menu as $k => $v) { $this->array[$v['id']] = array('id' => $v['id'], 'pid' => $v['parent_id'], 'name' => $v['name'], 'is_display' => $v['is_display'], 'ico' => $v['icon'], 'desc' => $v['desc'], 'sort' => $v['sort'], 'm' => $v['module_name'], 'c' => $v['controller_name'], 'a' => $v['action_name']); } }
public function getSidebarData() { //查询开启的系统侧边栏 $db = parent::getDb(); $res = $db->table('sidebar')->getAll(array('show' => \Admin\Sidebar\Type\Show::STATUS_ENABLE))->order('sort')->done(); foreach ($res as $v) { $data = unserialize($v['data']); $callback = $v['title']; $sidebarSystemData = $sidebarDiyData = array(); if ($v['group'] == \Admin\Sidebar\Type\Group::SIDEBAR_SYSTEM) { /*$class = new \ReflectionClass('\System\Library\sidebar'); $instance = $class->newInstanceArgs(); $method = $class->getmethod($callback); $sidebarSystemData[$callback] = $method->invokeArgs($instance,array($data));*/ $sidebarSystemData[$callback] = \System\Library\sidebar::init($callback, $data); } else { $sidebarDiyData[$callback] = \System\Library\sidebar::init($callback, $data); } } return array('system' => $sidebarSystemData, 'diy' => $sidebarDiyData); }
/** * Deactivate one item in database * @param $id * @param string $table * @return array */ public function delete($id, $table = self::TABLE_NAME) { return parent::delete($id, $table); }
/** * Fetch one row from table {delivery_method_options} * @param $id * @param string $table * @return array */ public function fetchOne($id, $table = self::TABLE_NAME) { return parent::fetchOne($id, $table); }
/** * __construct method * @param string/null $tbName (default value null) * */ public function __construct($tbName = null) { parent::__construct($tbName); }
/** * 获取文章分类名 * @param $id * @return mixed */ public function getArticleCategory($id) { $Db = parent::getDb(); $category = $Db->table('article_category')->getRow(array('id' => $id))->done(); return $category['name']; }
function db($name = "default") { return \System\Core\Model::getDb($name); }