本文整理汇总了PHP中Tab::add_content方法的典型用法代码示例。如果您正苦于以下问题:PHP Tab::add_content方法的具体用法?PHP Tab::add_content怎么用?PHP Tab::add_content使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tab
的用法示例。
在下文中一共展示了Tab::add_content方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_index
/**
* View users profile
*/
public function action_index()
{
$id = $this->request->param('id');
$user = ORM::factory('User', $id);
if (!$user->loaded()) {
throw HTTP_Exception::Factory('404', 'No such user');
}
$container = new Tabs();
$about = new Tab('About me');
$about->add_content(new Tab_Text($user->get_property('about')));
$about->add_content(new Tab_Text($user->get_property('signature')));
$container->add_tab($about);
Event::fire('user.profile_tabs', array($user, $container));
$this->view = new View_User_Profile();
$this->view->user = $user;
$this->view->tabs = $container->render();
/*
// @TODO, This belongs to the pet module, better to use events?
$pets = ORM::factory('User_Pet')
->where('user_id', '=', $user->id)
->order_by('active', 'desc');
$paginate = Paginate::factory($pets)
->execute();
$this->view = new View_User_Profile;
$this->view->pagination = $paginate->render();
$this->view->profile_user = $user;
// $this->view->pets = ORM::factory('User_Pet')->where('user_id', '=', $user->id)->order_by('active', 'desc')->find_all()->as_array();
$this->view->pets = $paginate->result();
*/
}
示例2: user_profile
public static function user_profile(Model_User $user, Tabs $tabs)
{
$pets = ORM::factory('User_Pet')->where('user_id', '=', $user->id)->order_by('active', 'desc')->find_all();
$tab = new Tab('Pets');
$tab->add_content(new Tab_PetList($user, $pets->as_array()));
$tabs->add_tab($tab);
}