本文整理匯總了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);
}