本文整理汇总了PHP中MessageBox::writeNotice方法的典型用法代码示例。如果您正苦于以下问题:PHP MessageBox::writeNotice方法的具体用法?PHP MessageBox::writeNotice怎么用?PHP MessageBox::writeNotice使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MessageBox
的用法示例。
在下文中一共展示了MessageBox::writeNotice方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _validPerform
protected function _validPerform($request, $response)
{
$mail_data = $this->dataspace->export();
if (isset($mail_data['sender_name'])) {
$sender_name = $mail_data['sender_name'];
} else {
$sender_name = $mail_data['sender_firstname'] . ' ' . $mail_data['sender_lastname'];
}
$body = sprintf(Strings::get('body_template', 'feedback'), $sender_name, $mail_data['sender_email'], $mail_data['body']);
$body = str_replace('<br>', "\n", $body);
$subject = $this->_getMailSubject();
$recipient_email = $this->_getEmail();
$mailer = $this->_getMailer();
$headers['From'] = $mail_data['sender_email'];
$headers['To'] = $recipient_email;
$headers['Subject'] = $subject;
if (!$recipient_email || !$mailer->send($recipient_email, $headers, $body)) {
MessageBox::writeNotice(Strings::get('mail_not_sent', 'feedback'));
$request->setStatus(Request::STATUS_FAILUER);
return;
}
MessageBox::writeNotice(Strings::get('message_was_sent', 'feedback'));
$request->setStatus(Request::STATUS_FORM_SUBMITTED);
$response->redirect($_SERVER['PHP_SELF']);
}
示例2: _validPerform
protected function _validPerform($request, $response)
{
$data = $this->dataspace->export();
$request->setStatus(Request::STATUS_FAILURE);
if ($request->hasAttribute('popup')) {
$response->write(closePopupResponse($request));
}
if (!isset($data['ids']) || !is_array($data['ids'])) {
return;
}
$objects = $this->_getObjectsToDelete(array_keys($data['ids']));
foreach ($objects as $id => $item) {
if ($item['delete_status'] !== 0) {
continue;
}
$site_object = wrapWithSiteObject($item);
try {
$site_object->delete();
} catch (LimbException $e) {
MessageBox::writeNotice("object {$id} - {$item['title']} couldn't be deleted!");
$request->setStatus(Request::STATUS_FAILURE);
throw $e;
}
}
$request->setStatus(Request::STATUS_SUCCESS);
$response->write(closePopupResponse($request));
}
示例3: _applyAccessPolicy
function _applyAccessPolicy($object, $action)
{
$access_policy = new AccessPolicy();
$access_policy->applyAccessTemplates($object, $action);
if (catch_error('LimbException', $e)) {
}
MessageBox::writeNotice("Access template of " . get_class($object) . " for action '{$action}' not defined!!!");
}
示例4: _applyAccessPolicy
protected function _applyAccessPolicy($object, $action)
{
try {
$access_policy = new AccessPolicy();
$access_policy->applyAccessTemplates($object, $action);
} catch (LimbException $e) {
MessageBox::writeNotice("Access template of " . get_class($object) . " for action '{$action}' not defined!!!");
}
}
示例5: perform
public function perform($request, $response)
{
$object = Limb::toolkit()->createSiteObject('UserObject');
if (!$object->activatePassword()) {
MessageBox::writeNotice('Password activation failed!');
$request->setStatus(Request::STATUS_FAILED);
$response->redirect('/');
}
}
示例6: _updateObjectOperation
protected function _updateObjectOperation()
{
$this->object->set('files_data', $_FILES[$this->name]);
try {
$this->object->updateVariations();
} catch (SQLException $e) {
throw $e;
} catch (LimbException $e) {
MessageBox::writeNotice('Some variations were not resized');
}
}
示例7: _updateObjectOperation
function _updateObjectOperation()
{
$this->object->set('files_data', $_FILES[$this->name]);
$this->object->updateVariations();
if (catch_error('SQLException', $e)) {
return throw_error($e);
} elseif (catch_error('LimbException', $e)) {
MessageBox::writeNotice('Some variations were not resized');
} elseif (catch_error('LimbException', $e)) {
return throw_error($e);
}
}
示例8: _validPerform
protected function _validPerform($request, $response)
{
$object = Limb::toolkit()->createSiteObject('PollContainer');
$data = $this->dataspace->export();
$request->setStatus(Request::STATUS_FAILURE);
if (!isset($data['answer'])) {
MessageBox::writeNotice(Strings::get('no_answer', 'poll'));
return;
}
$object->registerAnswer($data['answer']);
$request->setStatus(Request::STATUS_FORM_SUBMITTED);
}
示例9: _validPerform
function _validPerform(&$request, &$response)
{
$params = array();
$params['identifier'] = $this->dataspace->get('identifier');
$params['parent_path'] = $this->dataspace->get('parent_path');
$params['class'] = $this->dataspace->get('class_name');
$params['title'] = $this->dataspace->get('title');
$toolkit =& Limb::toolkit();
$object =& $toolkit->createSiteObject($params['Class']);
$datasource =& $toolkit->getDatasource('SingleObjectDatasource');
$datasource->setPath($params['parent_path']);
$is_root = false;
if (!($parent_data = $datasource->fetch())) {
if ($params['parent_path'] == '/') {
$is_root = true;
} else {
MessageBox::writeNotice('parent wasn\'t retrieved by path ' . $params['parent_path']);
$request->setStatus(Request::STATUS_FAILURE);
return;
}
}
if (!$is_root) {
$params['parent_node_id'] = $parent_data['node_id'];
} else {
$params['parent_node_id'] = 0;
}
$object->merge($params);
$object->create($is_root);
if (catch_error($e, 'LimbException')) {
MessageBox::writeNotice('object wasn\'t registered!');
$request->setStatus(Request::STATUS_FAILURE);
return;
} elseif (catch_error($e, 'LimbException')) {
return throw_error($e);
}
if (!$is_root) {
$parent_object =& $toolkit->createSiteObject($parent_data['ClassName']);
$parent_object->merge($parent_data);
$controller =& $parent_object->getController();
$action = $controller->determineAction();
$access_policy = new AccessPolicy();
$access_policy->saveNewObjectAccess($object, $parent_object, $action);
}
$request->setStatus(Request::STATUS_FORM_SUBMITTED);
if ($request->hasAttribute('popup')) {
$response->write(closePopupResponse($request));
}
}