Add a lock flash message if the resource is locked

@param   ControllerContextModel   $context A command context object
@return  void
969760
protected function _afterRead(ControllerContextModel $context)
    {
        $entity = $context->result;

        //Add the notice if the resource is locked
        if($this->canEdit() && $entity->isLockable() && $entity->isLocked())
        {
            //Prevent a re-render of the message
            if($context->request->getUrl() != $context->request->getReferrer())
            {
                if($entity->isLockable() && $entity->isLocked())
                {
                    $user    = $entity->getLocker();
                    $date    = $this->getObject('date', array('date' => $entity->locked_on));
                    $message = $this->getObject('translator')->translate(
                        'Locked by {name} {date}', array('name' => $user->getName(), 'date' => $date->humanize())
                    );

                    $context->response->addMessage($message, 'notice');
                }
            }
        }
    }
640477
public function locked()
    {
        $this->defaultData();
	    $resource = $this->getResource($this->getRequestParameter('id'));
	    $lockData = LockManager::getImplementation()->getLockData($resource);

	    $this->setData('topclass-label',
	        $this->hasRequestParameter('topclass-label') ? $this->getRequestParameter('topclass-label') : __('Resource')
        );

	    if (AclProxy::hasAccess($this->getSession()->getUser(), __CLASS__, 'forceRelease', array('uri' => $resource->getUri()))) {
	        $this->setData('id', $resource->getUri());
            $this->setData('forceRelease', true);
	    }

	    $this->setData('lockDate', $lockData->getCreationTime());
	    $this->setData('ownerHtml', UserHelper::renderHtmlUser($lockData->getOwnerId()));

	    if ($this->hasRequestParameter('view') && $this->hasRequestParameter('ext')) {
	        $this->setView($this->getRequestParameter('view'), $this->getRequestParameter('ext'));
	    } else {
	        $this->setView('Lock/locked.tpl', 'tao');
	    }
	}
94762
private function atLeastOneConditionHolds(Context $context)
    {
        foreach ($this->conditions as $condition) {
            if ($condition->holdsFor($context)) {
                return true;
            }
        }

        return false;
    }
214325
protected function _actionSend(KDispatcherContextInterface $context)
    {
        $request  = $this->getRequest();
        $response = $this->getResponse();

        //Add an Allow header to the response
        if($response->getStatusCode() === KHttpResponse::METHOD_NOT_ALLOWED)
        {
            try {
                $this->_actionOptions($context);
            }
            catch (Exception $e) {}
        }

        parent::_actionSend($context);
    }
534991
public function getContext(ControllerContextInterface $context = null)
    {
        $context = new ControllerContext($context);
        $context->setRequest($this->getRequest());
        $context->setResponse($this->getResponse());
        $context->setUser($this->getUser());

        return $context;
    }
1103805
protected function _beforeSend(DispatcherContext $context)
    {
        foreach($this->__authenticator_queue as $authenticator)
        {
            if($authenticator->challengeResponse($context) === true) {
                break;
            }
        }
    }
589565
protected function _actionException(AnCommandContext $context)
    {
        if (
            $context->data instanceof LibBaseControllerExceptionUnauthorized &&
            $this->getController() instanceof ComPeopleControllerSession
        ) {
            $context->response->send();
            exit(0);
        } else {
            parent::_actionException($context);
        }
    }
791866
public function setContext(RequestContext $context)
    {
        if (null !== $this->generator) {
            $this->getGenerator()->setContext($context);
        }
        $this->context = $context;
    }
867858
protected function _lockResource(KControllerContextInterface $context)
    {
        $domain = $this->getMixer()->getIdentifier()->domain;

        if ($domain === 'admin' || $this->getRequest()->query->layout === 'form') {
            parent::_lockResource($context);
        }
    }
867049
public function initializeContext(Context $context)
    {
        if (!$context instanceof GuzzleAwareContext) {
            return;
        }

        $context->setGuzzleClient($this->client);
        $context->setGuzzleParameters($this->parameters);
    }
1024565
protected function _afterBrowse(KControllerContextInterface $context)
    {
        $controller = $this->getController();

        if($controller->canAdd()) {
            $this->addCommand('new');
        }

        if($controller->canDelete()) {
            $this->addCommand('delete');
        }
    }
214919
protected function _beforeInsert(DatabaseContext $context)
    {
        $mixer = $this->getMixer();
        $table = $mixer instanceof DatabaseRowInterface ?  $mixer->getTable() : $mixer;

        if($this->hasProperty('created_by') && empty($this->created_by)) {
            $this->created_by  = (int) $this->getObject('user')->getId();
        }

        if($this->hasProperty('created_on') && (empty($this->created_on) || $this->created_on == $table->getDefault('created_on'))) {
            $this->created_on  = gmdate('Y-m-d H:i:s');
        }
    }
18739
protected function _actionAddapp(AnCommandContext $context)
    {
        $data = $context->data;
        $this->getItem()->components->insert($data->app);
        $this->commit();
    }
1268656
protected function _afterAdd(KControllerContextInterface $context)
    {
        $entity  = $context->result;
        $name    = $entity->getIdentifier()->name;

        if ($name === $this->_entity && $entity->getStatus() !== KDatabase::STATUS_FAILED) {
            $this->_getDispatcher()->trigger('onFinderAfterSave', array($this->_event_context, $entity, true));
        }
    }
1354040
protected function _actionAddrequest(AnCommandContext $context)
    {
        if ($this->getItem()->eql($this->actor)) {
            throw new LibBaseControllerExceptionForbidden('Forbidden');
        }

        $this->getResponse()->status = AnHttpResponse::RESET_CONTENT;
        $this->getItem()->addRequester($this->actor);
        $this->createNotification(array(
            'subject' => $this->actor,
            'target' => $this->getItem(),
            'name' => 'actor_request',
          ));

        return $this->getItem();
    }
1022025
protected function _actionAdd(KControllerContextInterface $context)
    {
        if(!$context->result instanceof KModelEntityInterface) {
            $entity = $this->getModel()->create($context->request->data->toArray());
        } else {
            $entity = $context->result;
        }

        //Only throw an error if the action explicitly failed.
        if($entity->save() === false)
        {
            $error = $entity->getStatusMessage();
            throw new KControllerExceptionActionFailed($error ? $error : 'Add Action Failed');
        }
        else
        {
            if ($entity instanceof KModelEntityInterface)
            {
                $url = clone $context->request->getUrl();

                if ($this->getModel()->getState()->isUnique())
                {
                    $states = $this->getModel()->getState()->getValues(true);

                    foreach ($states as $key => $value) {
                        $url->query[$key] = $entity->getProperty($key);
                    }
                }
                else $url->query[$entity->getIdentityKey()] = $entity->getProperty($entity->getIdentityKey());

                $context->response->headers->set('Location', (string) $url);
                $context->response->setStatus(KHttpResponse::CREATED);
            }
        }

        return $entity;
    }
804391
protected function _beforeAdd(KControllerContextInterface $context)
    {
        $context->request->data->ip = $this->getObject('request')->getAddress();
    }