本文整理汇总了PHP中AppController::index方法的典型用法代码示例。如果您正苦于以下问题:PHP AppController::index方法的具体用法?PHP AppController::index怎么用?PHP AppController::index使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AppController
的用法示例。
在下文中一共展示了AppController::index方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
$feedUsers = $this->_userConnections();
$feedUsers[] = User::get('id');
$Workspace = ClassRegistry::init('Workspace');
$workspaces = $Workspace->find('all', $this->Acl->conditions(array('fields' => 'id'), array('cache' => false)));
$workspaceIds = Set::extract('/Workspace/id', $workspaces);
if (empty($workspaceIds)) {
$workspaceIds = -1;
}
$conditions = array();
switch (true) {
case !empty($this->params['named']['view']):
// keep conditions empty
break;
case $this->Session->check('Stack.id'):
$conditions = array('conditions' => array('Feed.stack_id' => $this->Session->read('Stack.id')));
break;
case $this->Session->check('Milestone.id'):
$conditions = array('conditions' => array('Feed.milestone_id' => $this->Session->read('Milestone.id')));
break;
case $this->Session->check('Workspace.id'):
$conditions = array('conditions' => array('Feed.workspace_id' => $this->Session->read('Workspace.id')));
break;
default:
$conditions = array('conditions' => array('OR' => array('Feed.user_id' => $feedUsers, 'Feed.workspace_id' => $workspaceIds)));
}
$conditions = Set::merge($conditions, array('order' => array('Feed.id DESC'), 'contain' => array('User' => array('fields' => array('id', 'name', 'email', 'facebook_id')), 'Milestone' => array('fields' => array('id', 'name')), 'Stack' => array('fields' => array('id', 'name')), 'Workspace' => array('fields' => array('id', 'name'))), 'limit' => 20));
if (isset($this->params['named']['user'])) {
$conditions['conditions'][] = array('User.id' => $this->params['named']['user']);
}
$this->paginate = $conditions;
$this->set('title_for_layout', 'Feed');
parent::index();
}
示例2: index
public function index()
{
$this->paginate = array('conditions' => array('Notification.receiver_id' => User::get('id')), 'contain' => array('NotificationType', 'User'), 'order' => array('Notification.id' => 'DESC'));
parent::index();
$this->Notification->updateAll(array('is_read' => 1), array('Notification.receiver_id' => User::get('id')));
$this->Notification->User->id = User::get('id');
$this->Notification->User->saveField('notification_count', 0);
}
示例3: index
function index()
{
parent::index();
$q = $this->Ingredient->find('list', array('fields' => array('Ingre'), 'empty' => 'Selection d\'un ingrédient'));
$this->set('ingredients', $q);
$u = $this->Unity->find('list', array('fields' => array('nom_unite'), 'empty' => 'Selection d\'une unité'));
$this->set('unitys', $u);
$this->layout = 'default';
}
示例4: index
public function index()
{
if (isset($this->params['page'])) {
$this->data->appendTo('pageTitle', ' ' . __('Seite :1', (int) $this->params['page']));
}
if (in_array($this->layout, array('rss', 'ical', 'txt'))) {
$this->BlogPost->unbind('Comment');
}
parent::index();
}
示例5: index
public function index()
{
// if they are not in a workspace, let's refresh their cache
// and merge the aclConditions in
if ($this->Session->check('Workspace.id')) {
$aclOptions = array('cache' => false, 'merge' => false);
} else {
$aclOptions = array('cache' => true, 'merge' => true);
}
// setup our conditions and filter them
$this->paginate = $this->_filterLevel($this->Acl->conditions(array('contain' => array('User' => array('fields' => array('id', 'name')))), $aclOptions));
parent::index(true);
}
示例6: index
public function index()
{
if ($this->RequestHandler->prefers('json')) {
$conditions = array('fields' => array('id', 'name'), 'conditions' => array('id' => $this->_userConnections()));
$results = $this->Connection->User->find('all', $conditions);
$connections = array();
foreach ($results as $result) {
$result = $result['User'];
$connections[] = array('value' => $result['id'], 'caption' => $result['name']);
}
$this->set(compact('connections'));
} else {
$this->paginate = array('conditions' => array('or' => array('User.id' => User::get('id'), 'Receiver.id' => User::get('id'))), 'order' => array('Connection.is_approved' => 'ASC', 'Connection.id' => 'DESC'), 'contain' => array('User' => array('fields' => array('id', 'name', 'email', 'facebook_id', 'username')), 'Receiver' => array('fields' => array('id', 'name', 'email', 'facebook_id', 'username'))));
parent::index();
}
}
示例7: index
public function index()
{
// if they are not in a workspace, let's refresh their cache
// and merge the aclConditions in
if ($this->Session->check('Workspace.id')) {
$aclOptions = array('cache' => false, 'merge' => false);
} else {
$aclOptions = array('cache' => true, 'merge' => true);
}
// setup our conditions
$conditions = array('TaskGroup' => $this->Acl->conditions(array('order' => array('TaskGroup.order' => 'ASC'), 'limit' => null), $aclOptions));
// if they pass a stack only show them task groups under that stack
if (!empty($this->params['named']['stack'])) {
$conditions['TaskGroup']['conditions'] = array('TaskGroup.stack_id' => $this->params['named']['stack']);
}
// filter our conditions
$this->paginate = $this->_filterLevel($conditions, 'TaskGroup');
parent::index();
}
示例8: index
public function index()
{
// if they are not in a workspace, let's refresh their cache
// and merge the aclConditions in
if ($this->Session->check('Workspace.id')) {
$aclOptions = array('cache' => false, 'merge' => false);
} else {
$aclOptions = array('cache' => true, 'merge' => true);
}
// the calendar is requesting milestones
if ($this->RequestHandler->prefers('json')) {
// setup our conditions
$conditions = $this->Acl->conditions(array('fields' => array('id', 'name', 'starts', 'ends')), $aclOptions);
// filter our conditions
$conditions = $this->_filterLevel($conditions);
$this->__calendarResponse($conditions);
return;
}
// setup our conditions and filter them
$this->paginate = $this->_filterLevel($this->Acl->conditions(null, $aclOptions));
parent::index(true);
}
示例9: index
public function index()
{
// if they are not in a workspace, let's refresh their cache
// and merge the aclConditions in
if ($this->Session->check('Workspace.id')) {
$aclOptions = array('cache' => false, 'merge' => false);
} else {
$aclOptions = array('cache' => true, 'merge' => true);
}
// the calendar is requesting tasks
if ($this->RequestHandler->prefers('json')) {
// setup our conditions
$conditions = $this->Acl->conditions(array('fields' => array('id', 'name', 'due'), 'conditions' => array('NOT' => array('Task.due' => NULL), 'is_complete' => NULL)), $aclOptions);
// filter our conditions
$this->paginate = $this->_filterLevel($conditions);
parent::index();
return;
}
// the request is for a stack
if (!empty($this->params['named']['stack'])) {
// setup our conditions
$conditions = $this->Acl->conditions(array('conditions' => array('Task.is_complete' => NULL, 'Task.stack_id' => $this->params['named']['stack'])), $aclOptions);
// filter our conditions
$this->paginate = $conditions;
parent::index();
return;
}
// setup our conditions
$conditions = array('TaskGroup' => $this->Acl->conditions(array('contain' => array('Task' => array('conditions' => array('is_complete' => NULL), 'order' => array('Task.order' => 'ASC'), 'AssignedTo' => array('fields' => array('id', 'name')), 'Stack' => array('fields' => array('id', 'name')))), 'order' => array('TaskGroup.order' => 'ASC')), $aclOptions));
// if they pass a task-group show them only that task group
if (!empty($this->params['named']['task-group'])) {
$conditions['TaskGroup']['conditions'] = array('TaskGroup.id' => $this->params['named']['task-group']);
}
// filter our conditions
$this->paginate = $this->_filterLevel($conditions, 'TaskGroup');
parent::index(array('controller' => 'task_groups', 'action' => 'add'), 'TaskGroup');
}
示例10: index
public function index()
{
$this->setRelated();
parent::index();
}
示例11: index
public function index()
{
// setup our conditions
$this->paginate = $this->Acl->conditions();
parent::index(array('controller' => 'workspaces', 'action' => 'add'), 'Workspace');
}
示例12: index
public function index()
{
$this->paginate = array('conditions' => array('Dashboard.user_id' => User::get('id')), 'order' => array('Dashboard.order' => 'ASC'));
parent::index();
}
示例13: check_logged_in
<?php
function check_logged_in()
{
BaseController::check_logged_in();
}
$routes->get('/', function () {
if ($user = AuthController::get_user_logged_in()) {
AppController::index();
} else {
AuthController::index();
}
});
$routes->post('/login', function () {
// Kirjautumisen käsittely
AuthController::handle_login();
});
$routes->get('/logout', function () {
AuthController::signout();
});
$routes->get('/signup', function () {
AuthController::signup();
});
$routes->post('/signup', function () {
AuthController::handle_signup();
});
$routes->get('/tasks/create', 'check_logged_in', function () {
AppController::createTask();
});
$routes->post('/tasks/create', 'check_logged_in', function () {
AppController::storeTask();
示例14: index
public function index()
{
parent::index();
}
示例15: index
public function index()
{
AppController::index();
$this->set('zeitzonenliste', timezone_identifiers_list());
}