本文整理汇总了PHP中AppController::edit方法的典型用法代码示例。如果您正苦于以下问题:PHP AppController::edit方法的具体用法?PHP AppController::edit怎么用?PHP AppController::edit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AppController
的用法示例。
在下文中一共展示了AppController::edit方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edit
public function edit($id = null)
{
if (!$id && !$this->Session->check('Workspace.id')) {
$this->Redirect->flash('not_in_workspace', array('controller' => 'workspaces', 'action' => 'index'));
}
if (!empty($this->data['Event'])) {
$this->data['Event']['starts'] = date('Y-m-d H:i:s', strtotime($this->data['Event']['starts']));
if (isset($this->data['Event']['ends']) && $this->data['Event']['ends'] === '') {
$this->data['Event']['ends'] = null;
} else {
$this->data['Event']['ends'] = date('Y-m-d H:i:s', strtotime($this->data['Event']['ends']));
if ($this->data['Event']['ends'] < $this->data['Event']['starts']) {
$this->data['Event']['ends'] = $this->data['Event']['starts'];
}
}
}
$milestones = $this->Event->Milestone->find('list', array('conditions' => array('workspace_id' => $this->Session->read('Workspace.id'))));
$this->set(compact('milestones'));
if ($this->Session->check('Milestone.id')) {
$stacksConditions = array('conditions' => array('milestone_id' => $this->Session->read('Milestone.id')));
} else {
$stacksConditions = array('conditions' => array('workspace_id' => $this->Session->read('Workspace.id')));
}
$stacks = $this->Event->Stack->find('list', $stacksConditions);
$this->set(compact('stacks'));
parent::edit($id);
}
示例2: edit
public function edit($id = null)
{
if (!$id && !$this->Session->check('Workspace.id')) {
$this->Redirect->flash('not_in_workspace', array('controller' => 'workspaces', 'action' => 'index'));
}
if (!empty($this->data['Stack'])) {
if (isset($this->data['Stack']['due']) && $this->data['Stack']['due'] === '') {
$this->data['Stack']['due'] = null;
} else {
$this->data['Stack']['due'] = date('Y-m-d H:i:s', strtotime($this->data['Stack']['due']));
}
if (!empty($this->data['Stack']['id']) && !empty($this->data['Stack']['assigned_to_id'])) {
$this->Stack->id = $this->data['Stack']['id'];
$oldAssignedToId = $this->Stack->field('assigned_to_id');
}
}
$Subscription = ClassRegistry::init('Subscription');
$subscribers = $Subscription->findAllByClassAndForeignId('Workspace', $this->Session->read('Workspace.id'));
$subscribers = Set::extract('/Subscription/user_id', $subscribers);
$assignedTos = $this->Stack->User->findList(array('conditions' => array('User.id' => $subscribers), 'fields' => array('id', 'name')));
$this->set(compact('assignedTos'));
$milestones = $this->Stack->Milestone->find('list', array('conditions' => array('workspace_id' => $this->Session->read('Workspace.id'))));
$this->set(compact('milestones'));
if (parent::edit($id, false)) {
if (!empty($this->data['Stack']['assigned_to_id'])) {
if (!isset($oldAssignedToId) || isset($oldAssignedToId) && $oldAssignedToId !== $this->data['Stack']['assigned_to_id']) {
$this->Stack->notify($this->data['Stack']['assigned_to_id'], $this->Stack->id, $this->Tools->keyToId('stack_assigned', 'NotificationType'));
}
}
$this->_setLevel('stack');
$this->Redirect->flash(array('save_ok', 'Stack'), array('controller' => 'stacks', 'action' => 'index'));
}
}
示例3: edit
public function edit($id = null)
{
if (!$this->Session->check('Workspace.id')) {
$this->Redirect->flash('not_in_workspace', array('controller' => 'workspaces', 'action' => 'index'));
}
if (!empty($this->data['TaskGroup'])) {
if (!empty($this->data['TaskGroup']['id']) && !empty($this->data['TaskGroup']['assigned_to_id'])) {
$this->TaskGroup->id = $this->data['TaskGroup']['id'];
$oldAssignedToId = $this->TaskGroup->field('assigned_to_id');
}
}
$Subscription = ClassRegistry::init('Subscription');
$subscribers = $Subscription->findAllByClassAndForeignId('Workspace', $this->Session->read('Workspace.id'));
$subscribers = Set::extract('/Subscription/user_id', $subscribers);
$assignedTos = $this->TaskGroup->User->findList(array('conditions' => array('User.id' => $subscribers), 'fields' => array('id', 'name')));
$this->set(compact('assignedTos'));
$milestones = $this->TaskGroup->Milestone->find('list', array('conditions' => array('workspace_id' => $this->Session->read('Workspace.id'))));
$this->set(compact('milestones'));
$stacksConditions = array();
if ($this->Session->check('Milestone.id')) {
$stacksConditions = array('conditions' => array('milestone_id' => $this->Session->read('Milestone.id')));
} else {
$stacksConditions = array('conditions' => array('workspace_id' => $this->Session->read('Workspace.id')));
}
$stacks = $this->TaskGroup->Stack->find('list', $stacksConditions);
$this->set(compact('stacks'));
parent::edit($id, array('controller' => 'tasks', 'action' => 'index'));
}
示例4: edit
public function edit()
{
// redirect to index after creating a new page
parent::edit(null, array('action' => 'index'));
if ($this->Session->check('Milestone.id')) {
$stacksConditions = array('conditions' => array('milestone_id' => $this->Session->read('Milestone.id')));
} else {
$stacksConditions = array('conditions' => array('workspace_id' => $this->Session->read('Workspace.id')));
}
$stacks = $this->WikiPage->Stack->find('list', $stacksConditions);
$this->set(compact('stacks'));
}
示例5: edit
public function edit($id = null)
{
if (parent::edit($id, false)) {
$this->_setLevel('workspace');
$this->Workspace->subscribe(User::get('id'), $this->Workspace->id);
// setup our default redirect
$redirect = array('controller' => 'workspaces', 'action' => 'index');
// if they are just creating the workspace, load them into it
if (empty($this->data['Workspace']['id'])) {
$redirect = array('controller' => 'workspaces', 'action' => 'view', $this->Workspace->id);
}
$this->Redirect->flash(array('save_ok', 'Workspace'), $redirect);
}
}
示例6: edit
public function edit($id = null)
{
if (parent::edit($id, false, false)) {
$Model = ClassRegistry::init($this->data['Comment']['class']);
$item = $Model->findById($this->data['Comment']['foreign_id']);
switch ($this->data['Comment']['class']) {
case 'Task':
if ($item['Task']['assigned_to_id'] != User::get('id')) {
$Model->notify($item['Task']['assigned_to_id'], $this->data['Comment']['foreign_id'], $this->Tools->keyToId('commented_on', 'NotificationType'));
}
break;
}
$this->Redirect->flash(null, $this->referer);
}
foreach ($this->params['named'] as $class => $foreign_id) {
$this->data['Comment']['class'] = ucfirst(Inflector::variable($class));
$this->data['Comment']['foreign_id'] = $foreign_id;
}
$this->render('edit');
}
示例7: edit
public function edit($id = null)
{
if (!$id && !$this->Session->check('Workspace.id')) {
$this->Redirect->flash('not_in_workspace', array('controller' => 'workspaces', 'action' => 'index'));
}
// check if we are editing the active version
if (!isset($this->data['ActiveVersion'])) {
$milestones = $this->Upload->Milestone->find('list', array('conditions' => array('workspace_id' => $this->Session->read('Workspace.id'))));
$this->set(compact('milestones'));
if ($this->Session->check('Milestone.id')) {
$stacksConditions = array('conditions' => array('milestone_id' => $this->Session->read('Milestone.id')));
} else {
$stacksConditions = array('conditions' => array('workspace_id' => $this->Session->read('Workspace.id')));
}
$stacks = $this->Upload->Stack->find('list', $stacksConditions);
$this->set(compact('stacks'));
parent::edit($id);
} else {
$this->Upload->updateAll(array('Upload.active_version_id' => $this->data['ActiveVersion']['id']), array('Upload.id' => $this->data['ActiveVersion']['upload_id'], 'Upload.workspace_id' => $this->Session->read('Workspace.id')));
$this->redirect(array('controller' => 'uploads', 'action' => 'view', $this->data['ActiveVersion']['upload_id']));
}
}
示例8: edit
public function edit($id = null)
{
if (!$id && !$this->Session->check('Workspace.id')) {
$this->Redirect->flash('not_in_workspace', array('controller' => 'workspaces', 'action' => 'index'));
}
if (!empty($this->data['Milestone'])) {
if (isset($this->data['Milestone']['due']) && $this->data['Milestone']['due'] === '') {
$this->data['Milestone']['due'] = null;
} else {
$this->data['Milestone']['due'] = date('Y-m-d H:i:s', strtotime($this->data['Milestone']['due']));
}
}
if (parent::edit($id, false)) {
$this->_setLevel('milestone');
// setup our default redirect
$redirect = array('controller' => 'milestones', 'action' => 'index');
// if they are just creating the milestone, load them into it
if (empty($this->data['Milestone']['id'])) {
$redirect = array('controller' => 'milestones', 'action' => 'view', $this->Milestone->id);
}
$this->Redirect->flash(array('save_ok', 'Milestone'), $redirect);
}
}
示例9: edit
function edit($id = null)
{
$this->set('typenliste', $this->Flugzeugtyp->find('list'));
AppController::edit($id);
}
示例10: edit
public function edit($id = null)
{
$users = $this->_userConnections();
$users = $this->Message->User->findList(array('conditions' => array('User.id' => $users)));
if ($id) {
$lastChild = $this->Message->getChildren($id, array('limit' => 1, 'sort' => 'desc'));
if (!empty($lastChild[0]['Message'])) {
$lastChild = $lastChild[0]['Message'];
$id = $lastChild['id'];
$rootId = $lastChild['root_id'];
} else {
$lastChild = $this->Message->findById($id);
$rootMessage = $lastChild['Message'];
$rootId = $rootMessage['root_id'];
}
$subscribers = $this->Message->getSubscribers($rootId);
$subscribers = $this->Message->User->findList(array('conditions' => array('User.id' => $subscribers)));
foreach ($subscribers as $subscriber) {
$key = array_search($subscriber, $users);
if ($key) {
unset($users[$key]);
}
}
$this->set('parent_id', $id);
$this->set(compact('subscribers'));
}
$this->set(compact('users'));
if (!empty($this->data)) {
if (!empty($this->data['Message']['parent_id'])) {
$lastChild = $this->Message->getChildren($this->data['Message']['parent_id'], array('limit' => 1, 'sort' => 'desc'));
if (!empty($lastChild[0]['Message'])) {
$lastChild = $lastChild[0]['Message'];
$this->data['Message']['parent_id'] = $lastChild['id'];
$rootMessageId = $lastChild['root_id'];
} else {
$lastChild = $this->Message->findById($this->data['Message']['parent_id']);
$this->data['Message']['parent_id'] = $lastChild['Message']['id'];
$rootMessageId = $lastChild['Message']['root_id'];
}
} else {
$this->data['Recipients'][] = User::get('id');
}
$recipients = null;
if (!empty($this->data['Recipients'])) {
$recipients = $this->data['Recipients'];
unset($this->data['Recipients']);
}
}
if (parent::edit($id, true, false) && !empty($this->data)) {
if (!empty($this->data['Message']['parent_id'])) {
$notificationKey = 'replied_to_message';
$redirectLocation = array('action' => 'index', 'inbox');
} else {
$rootMessageId = $this->Message->id;
$notificationKey = 'received_message';
$redirectLocation = array('action' => 'index', 'inbox');
}
$this->Message->subscribe($recipients, $rootMessageId);
$subscribers = $this->Message->getSubscribers($rootMessageId);
$this->_allow($subscribers, array('Message' => array('id' => $rootMessageId)));
$this->Message->setUnread($subscribers, $rootMessageId);
$this->Message->notify($subscribers, $rootMessageId, $this->Tools->keyToId($notificationKey, 'NotificationType'));
$this->Redirect->flash(array('add_ok', Inflector::humanize(strtolower($this->modelClass))), $redirectLocation);
}
}
示例11: edit
function edit($id = null)
{
if (!empty($this->data)) {
$this->addeditPost($this->data);
}
$this->pageTitle = 'Update ' . __('ACTIVITY_BRAND', true);
parent::edit($this->Activity, $id, '/suppliers/home');
$user = $this->get_CurrentUser();
$supplier = $this->Activity->Supplier->read(null, $user['Supplier']['id']);
$this->set('supplier', $supplier);
$this->set('member', $user);
$this->set('activities', $supplier['Activities']);
}
示例12: edit
function edit($id = null)
{
AppController::edit($id);
$this->set('Auswahlliste', array("Nein, ist kein Ablehnungsgrund", "Ja, ist Ablehnungsgrund"));
}
示例13: edit
function edit($id = null)
{
AppController::edit($id);
$this->set('herstellerliste', $this->Flugzeughersteller->find('list'));
}
示例14: edit
function edit($id = null)
{
AppController::edit($id);
$this->set('zeitzonenliste', timezone_identifiers_list());
}