本文整理汇总了PHP中Notify::message方法的典型用法代码示例。如果您正苦于以下问题:PHP Notify::message方法的具体用法?PHP Notify::message怎么用?PHP Notify::message使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Notify
的用法示例。
在下文中一共展示了Notify::message方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _deleteComment
/**
* Delete comment
*
* @return void
*/
protected function _deleteComment()
{
// Check permission
if (!$this->model->access('content')) {
App::abort(403, Lang::txt('ALERTNOTAUTH'));
}
// Incoming
$cid = Request::getInt('cid', 0);
// Instantiate comment
$objC = new \Components\Projects\Tables\Comment($this->_database);
if ($objC->load($cid)) {
$activityid = $objC->activityid;
// delete comment
if ($objC->deleteComment()) {
$this->_msg = Lang::txt('PLG_PROJECTS_BLOG_COMMENT_DELETED');
}
// delete associated activity
$objAA = $this->model->table('Activity');
if ($activityid && $objAA->load($activityid)) {
$objAA->deleteActivity();
}
}
// Pass error or success message
if ($this->getError()) {
Notify::message($this->getError(), 'error', 'projects');
} elseif (!empty($this->_msg)) {
Notify::message($this->_msg, 'success', 'projects');
}
// Redirect
App::redirect(Route::url($this->model->link()));
}
示例2: _list
/**
* List/unlist on public project page
*
* @return string
*/
protected function _list()
{
// Incoming
$id = trim(Request::getInt('p', 0));
// Load requested page
$page = $this->note->page($id);
if (!$page->get('id')) {
App::redirect(Route::url($this->model->link('notes')));
return;
}
$listed = $this->_task == 'publist' ? 1 : 0;
// Get/update public stamp for page
if ($this->note->getPublicStamp($page->get('id'), true, $listed)) {
$this->_msg = $this->_task == 'publist' ? Lang::txt('COM_PROJECTS_NOTE_MSG_LISTED') : Lang::txt('COM_PROJECTS_NOTE_MSG_UNLISTED');
\Notify::message($this->_msg, 'success', 'projects');
App::redirect(Route::url('index.php?option=' . $this->_option . '&scope=' . $page->get('scope') . '&pagename=' . $page->get('pagename')));
return;
}
App::redirect(Route::url($this->model->link('notes')));
return;
}
示例3: setNotification
/**
* Set notifications
*
* @param string $message
* @param string $type
* @return void
*/
public function setNotification($message, $type = 'success')
{
// If message is set push to notifications
if ($message != '') {
\Notify::message($message, $type, $this->_option);
}
}
示例4: _saveComment
/**
* Save comment
*
* @return void, redirect
*/
protected function _saveComment()
{
// Check for request forgeries
Request::checkToken();
// Check permission
if (!$this->model->access('content')) {
throw new Exception(Lang::txt('ALERTNOTAUTH'), 403);
return;
}
// Incoming
$itemid = Request::getInt('itemid', 0, 'post');
$comment = trim(Request::getVar('comment', '', 'post'));
$parent_activity = Request::getInt('parent_activity', 0, 'post');
// Clean-up
$comment = \Hubzero\Utility\Sanitize::stripScripts($comment);
$comment = \Hubzero\Utility\Sanitize::stripImages($comment);
$comment = \Hubzero\Utility\String::truncate($comment, 800);
// Instantiate comment
$objC = new \Components\Projects\Tables\Comment($this->_database);
if ($comment) {
$objC->itemid = $itemid;
$objC->tbl = 'todo';
$objC->parent_activity = $parent_activity;
$objC->comment = $comment;
$objC->created = Date::toSql();
$objC->created_by = $this->_uid;
if (!$objC->store()) {
$this->setError($objC->getError());
} else {
$this->_msg = Lang::txt('PLG_PROJECTS_TODO_COMMENT_POSTED');
}
// Get new entry ID
if (!$objC->id) {
$objC->checkin();
}
// Record activity
if ($objC->id) {
$what = Lang::txt('COM_PROJECTS_TODO_ITEM');
$url = Route::url($this->model->link('todo') . '&action=view&todoid=' . $itemid);
$aid = $this->model->recordActivity(Lang::txt('COM_PROJECTS_COMMENTED') . ' ' . Lang::txt('COM_PROJECTS_ON') . ' ' . $what, $objC->id, $what, $url, 'quote', 0);
}
// Store activity ID
if ($aid) {
$objC->activityid = $aid;
$objC->store();
}
}
// Pass error or success message
if ($this->getError()) {
\Notify::message($this->getError(), 'error', 'projects');
} elseif (!empty($this->_msg)) {
\Notify::message($this->_msg, 'success', 'projects');
}
// Redirect
App::redirect(Route::url($this->model->link('todo') . '&action=view&todoid=' . $itemid));
return;
}
示例5: cancelDraft
//.........这里部分代码省略.........
if ($confirm) {
if (!$this->getError()) {
$pubtitle = \Hubzero\Utility\String::truncate($pub->version->get('title'), 100);
if ($pub->version->get('state') == 1) {
// Unpublish published version
$pub->version->set('published_down', Date::toSql());
$pub->version->set('modified', Date::toSql());
$pub->version->set('modified_by', $this->_uid);
$pub->version->set('state', 0);
if (!$pub->version->store()) {
throw new Exception(Lang::txt('PLG_PROJECTS_PUBLICATIONS_PUBLICATION_UNPUBLISH_FAILED'), 403);
return;
} else {
$this->_msg = Lang::txt('PLG_PROJECTS_PUBLICATIONS_PUBLICATION_VERSION_UNPUBLISHED');
// Add activity
$action = Lang::txt('PLG_PROJECTS_PUBLICATIONS_ACTIVITY_UNPUBLISHED');
$action .= ' ' . strtolower(Lang::txt('version')) . ' ' . $pub->version->get('version_label') . ' ' . Lang::txt('PLG_PROJECTS_PUBLICATIONS_OF') . ' ' . strtolower(Lang::txt('publication')) . ' "' . $pubtitle . '" ';
$aid = $this->model->recordActivity($action, $pid, $pubtitle, Route::url($pub->link('editversion')), 'publication', 0);
}
} elseif ($pub->version->get('state') == 3 || $pub->version->get('state') == 4) {
$vlabel = $pub->version->get('version_label');
// Delete draft version
if (!$pub->version->delete()) {
throw new Exception(Lang::txt('PLG_PROJECTS_PUBLICATIONS_PUBLICATION_DELETE_DRAFT_FAILED'), 403);
return;
}
// Delete authors
$pa = new \Components\Publications\Tables\Author($this->_database);
$authors = $pa->deleteAssociations($vid);
// Delete attachments
$pContent = new \Components\Publications\Tables\Attachment($this->_database);
$pContent->deleteAttachments($vid);
// Delete screenshots
$pScreenshot = new \Components\Publications\Tables\Screenshot($this->_database);
$pScreenshot->deleteScreenshots($vid);
// Build publication path
$path = PATH_APP . DS . trim($this->_pubconfig->get('webpath'), DS) . DS . \Hubzero\Utility\String::pad($pid);
// Build version path
$vPath = $path . DS . \Hubzero\Utility\String::pad($vid);
// Delete all version files
if (is_dir($vPath)) {
Filesystem::deleteDirectory($vPath);
}
// Delete access accosiations
$pAccess = new \Components\Publications\Tables\Access($this->_database);
$pAccess->deleteGroups($vid);
// Delete audience
$pAudience = new \Components\Publications\Tables\Audience($this->_database);
$pAudience->deleteAudience($vid);
// Delete publication existence
if ($pub->versionCount() == 0) {
// Delete all files
if (is_dir($path)) {
Filesystem::delete($path);
}
$pub->publication->delete($pid);
$pub->publication->deleteExistence($pid);
// Delete related publishing activity from feed
$objAA = $this->model->table('Activity');
$objAA->deleteActivityByReference($this->model->get('id'), $pid, 'publication');
}
// Add activity
$action = Lang::txt('PLG_PROJECTS_PUBLICATIONS_ACTIVITY_DRAFT_DELETED');
$action .= ' ' . $vlabel . ' ';
$action .= Lang::txt('PLG_PROJECTS_PUBLICATIONS_OF_PUBLICATION') . ' "' . $pubtitle . '"';
$aid = $this->model->recordActivity($action, $pid, '', '', 'publication', 0);
$this->_msg = Lang::txt('PLG_PROJECTS_PUBLICATIONS_PUBLICATION_DRAFT_DELETED');
}
}
} else {
$view = new \Hubzero\Plugin\View(array('folder' => 'projects', 'element' => 'publications', 'name' => 'cancel'));
// Output HTML
$view->option = $this->_option;
$view->database = $this->_database;
$view->project = $this->model;
$view->uid = $this->_uid;
$view->pid = $pid;
$view->pub = $pub;
$view->publishedCount = $pub->version->getPublishedCount($pid);
$view->task = $this->_task;
$view->config = $this->model->config();
$view->pubconfig = $this->_pubconfig;
$view->ajax = $ajax;
$view->title = $this->_area['title'];
// Get messages and errors
$view->msg = $this->_msg;
if ($this->getError()) {
$view->setError($this->getError());
}
return $view->loadTemplate();
}
// Pass error or success message
if ($this->getError()) {
\Notify::message($this->getError(), 'error', 'projects');
} elseif (!empty($this->_msg)) {
\Notify::message($this->_msg, 'success', 'projects');
}
App::redirect($baseUrl);
return;
}
示例6: act_update
/**
* Update database
*
* @return array
*/
public function act_update()
{
// Check permission
if (!$this->model->access('content')) {
throw new Exception(Lang::txt('ALERTNOTAUTH'), 403);
return;
}
// Incoming
$id = Request::getVar('db_id', false);
$title = Request::getVar('db_title', false);
$description = Request::getVar('db_description', false);
// Get project database object
$objPD = new \Components\Projects\Tables\Database($this->_database);
if ($objPD->loadRecord($id)) {
$dd = json_decode($objPD->data_definition, true);
if ($title != '' && $objPD->project == $this->model->get('id')) {
// Setting title and description
$objPD->title = $title;
$dd['title'] = $title;
$objPD->description = $description;
$objPD->data_definition = json_encode($dd);
$objPD->store();
$this->_msg = Lang::txt('PLG_PROJECTS_DATABASES_UPDATED');
}
}
$url = str_replace($_SERVER['SCRIPT_URL'], '', $_SERVER['SCRIPT_URI']) . "/projects/" . $this->model->get('alias') . "/databases/";
// Pass success message
if (!empty($this->_msg)) {
\Notify::message($this->_msg, 'success', 'projects');
}
// Redirect
App::redirect($url);
return;
}
示例7: red
/**
* red method
*
* Shortcut for sending an error message
*
* @param mixed $fails
* @param mixed $params
* @return void
* @access public
*/
static function red($fails, $params)
{
list($title, $message) = Notify::_normalize($params);
Notify::message($title, $message, -2, 'error');
}
示例8: _save
/**
* Subscribe
*
* @return HTML
*/
private function _save()
{
// Check for request forgeries
Request::checkToken();
// Login required
if (User::isGuest() || !$this->project->exists()) {
App::redirect(Route::url($this->publication->link()));
}
// Incoming
$email = User::get('email');
$categories = Request::getVar('category', array());
$frequency = Request::getWord('frequency', 'immediate');
// Save subscription
$this->watch->loadRecord($this->project->get('id'), 'project', User::get('id'), $email);
$this->watch->item_id = $this->project->get('id');
$this->watch->item_type = 'project';
$this->watch->created_by = User::get('id');
$this->watch->state = empty($categories) ? 2 : 1;
$cats = array('blog' => 0, 'quote' => 0, 'team' => 0, 'files' => 0, 'publications' => 0, 'todo' => 0, 'notes' => 0);
$in = '';
foreach ($cats as $param => $value) {
if (isset($categories[$param])) {
$value = intval($categories[$param]);
}
if ($param == 'quote' && isset($categories['blog'])) {
$value = 1;
}
$in .= $in ? "\n" : '';
$in .= $param . '=' . $value;
}
$this->watch->params = $in;
if ($this->watch->check()) {
$this->watch->store();
}
if ($this->watch->getError()) {
App::redirect(Route::url($this->project->link()), $this->watch->getError(), 'error');
} else {
\Notify::message(Lang::txt('PLG_PROJECTS_WATCH_SUCCESS_SAVED'), 'success', 'projects');
App::redirect(Route::url($this->project->link()));
}
}
示例9: saveTask
/**
* Saves a project
* Redirects to main listing
*
* @return void
*/
public function saveTask($redirect = false)
{
// Check for request forgeries
Request::checkToken();
// Config
$setup_complete = $this->config->get('confirm_step', 0) ? 3 : 2;
// Incoming
$formdata = $_POST;
$id = Request::getVar('id', 0);
$action = Request::getVar('admin_action', '');
$message = rtrim(\Hubzero\Utility\Sanitize::clean(Request::getVar('message', '')));
// Load model
$model = new Models\Project($id);
if (!$model->exists()) {
App::redirect('index.php?option=' . $this->_option, Lang::txt('COM_PROJECTS_NOTICE_ID_NOT_FOUND'), 'error');
return;
}
$title = $formdata['title'] ? rtrim($formdata['title']) : $model->get('title');
$type = isset($formdata['type']) ? $formdata['type'] : 1;
$model->set('title', $title);
$model->set('about', rtrim(\Hubzero\Utility\Sanitize::clean($formdata['about'])));
$model->set('type', $type);
$model->set('modified', Date::toSql());
$model->set('modified_by', User::get('id'));
$model->set('private', Request::getVar('private', 0));
$this->_message = Lang::txt('COM_PROJECTS_SUCCESS_SAVED');
// Was project suspended?
$suspended = false;
if ($model->isInactive()) {
$suspended = $model->table('Activity')->checkActivity($id, Lang::txt('COM_PROJECTS_ACTIVITY_PROJECT_SUSPENDED'));
}
$subject = Lang::txt('COM_PROJECTS_PROJECT') . ' "' . $model->get('alias') . '" ';
$sendmail = 0;
// Get project managers
$managers = $model->table('Owner')->getIds($id, 1, 1);
// Admin actions
if ($action) {
switch ($action) {
case 'delete':
$model->set('state', 2);
$what = Lang::txt('COM_PROJECTS_ACTIVITY_PROJECT_DELETED');
$subject .= Lang::txt('COM_PROJECTS_MSG_ADMIN_DELETED');
$this->_message = Lang::txt('COM_PROJECTS_SUCCESS_DELETED');
break;
case 'suspend':
$model->set('state', 0);
$what = Lang::txt('COM_PROJECTS_ACTIVITY_PROJECT_SUSPENDED');
$subject .= Lang::txt('COM_PROJECTS_MSG_ADMIN_SUSPENDED');
$this->_message = Lang::txt('COM_PROJECTS_SUCCESS_SUSPENDED');
break;
case 'reinstate':
$model->set('state', 1);
$what = $suspended ? Lang::txt('COM_PROJECTS_ACTIVITY_PROJECT_REINSTATED') : Lang::txt('COM_PROJECTS_ACTIVITY_PROJECT_ACTIVATED');
$subject .= $suspended ? Lang::txt('COM_PROJECTS_MSG_ADMIN_REINSTATED') : Lang::txt('COM_PROJECTS_MSG_ADMIN_ACTIVATED');
$this->_message = $suspended ? Lang::txt('COM_PROJECTS_SUCCESS_REINSTATED') : Lang::txt('COM_PROJECTS_SUCCESS_ACTIVATED');
break;
}
// Add activity
$model->recordActivity($what, 0, '', '', 'project', 0, $admin = 1);
$sendmail = 1;
} elseif ($message) {
$subject .= ' - ' . Lang::txt('COM_PROJECTS_MSG_ADMIN_NEW_MESSAGE');
$sendmail = 1;
$this->_message = Lang::txt('COM_PROJECTS_SUCCESS_MESSAGE_SENT');
}
// Save changes
if (!$model->store()) {
$this->setError($model->getError());
return false;
}
// Incoming tags
$tags = Request::getVar('tags', '', 'post');
// Save the tags
$cloud = new Models\Tags($model->get('id'));
$cloud->setTags($tags, User::get('id'), 1);
// Save params
$incoming = Request::getVar('params', array());
if (!empty($incoming)) {
foreach ($incoming as $key => $value) {
if ($key == 'quota' || $key == 'pubQuota') {
// convert GB to bytes
$value = Helpers\Html::convertSize(floatval($value), 'GB', 'b');
}
$model->saveParam($key, $value);
}
}
// Add members if specified
$this->model = $model;
$this->_saveMember();
// Change ownership
$this->_changeOwnership();
// Send message
if ($this->config->get('messaging', 0) && $sendmail && count($managers) > 0) {
// Email config
//.........这里部分代码省略.........
示例10: savecite
/**
* Attach a citation to a publication (in non-curated flow)
*
* @return string
*/
public function savecite()
{
// Incoming
$cite = Request::getVar('cite', array(), 'post', 'none', 2);
$pid = Request::getInt('pid', 0);
$version = Request::getVar('version', 'dev');
$new = $cite['id'] ? false : true;
include_once PATH_CORE . DS . 'components' . DS . 'com_citations' . DS . 'tables' . DS . 'citation.php';
include_once PATH_CORE . DS . 'components' . DS . 'com_citations' . DS . 'tables' . DS . 'association.php';
if (!$pid || !$cite['type'] || !$cite['title']) {
$this->setError(Lang::txt('PLG_PROJECTS_PUBLICATIONS_CITATIONS_ERROR_MISSING_REQUIRED'));
} else {
$citation = new \Components\Citations\Tables\Citation($this->_database);
if (!$citation->bind($cite)) {
$this->setError($citation->getError());
} else {
$citation->created = $new == true ? Date::toSql() : $citation->created;
$citation->uid = $new == true ? $this->_uid : $citation->uid;
$citation->published = 1;
if (!$citation->store(true)) {
// This really shouldn't happen.
$this->setError(Lang::txt('PLG_PROJECTS_PUBLICATIONS_CITATIONS_ERROR_SAVE'));
}
}
// Create association
if (!$this->getError() && $new == true && $citation->id) {
$assoc = new \Components\Citations\Tables\Association($this->_database);
$assoc->oid = $pid;
$assoc->tbl = 'publication';
$assoc->type = 'owner';
$assoc->cid = $citation->id;
// Store new content
if (!$assoc->store()) {
$this->setError($assoc->getError());
}
}
\Notify::message(Lang::txt('PLG_PROJECTS_LINKS_CITATION_SAVED'), 'success', 'projects');
}
// Pass success or error message
if ($this->getError()) {
\Notify::message($this->getError(), 'error', 'projects');
}
// Build pub url
$route = $this->model->isProvisioned() ? 'index.php?option=com_publications&task=submit' : 'index.php?option=com_projects&alias=' . $this->model->get('alias') . '&active=publications';
App::redirect(Route::url($route . '&pid=' . $pid . '&version=' . $version . '§ion=citations'));
return;
}
示例11: _setNotification
/**
* Set notifications
*
* @param string $message
* @param string $type
* @return void
*/
protected function _setNotification($message, $type = 'success')
{
// If message is set push to notifications
if ($message != '') {
\Notify::message($message, $type, 'projects');
}
}
示例12: finalizeTask
/**
* Finalize the purchase process
*
* @return void
*/
public function finalizeTask()
{
// Check for request forgeries
Request::checkToken();
// Set page title
$this->_buildTitle();
// Set the pathway
$this->_buildPathway();
// Check authorization
if (User::isGuest()) {
$this->loginTask();
return;
}
$now = \Date::toSql();
// Get cart object
$item = new Cart($this->database);
// Calculate total
$cost = $item->getCartItems(User::get('id'), 'cost');
// Check available user funds
$BTL = new Teller(User::get('id'));
$balance = $BTL->summary();
$credit = $BTL->credit_summary();
$funds = $balance - $credit;
$funds = $funds > 0 ? $funds : '0';
// Get cart items
$items = $item->getCartItems(User::get('id'));
if (!$items or $cost > $funds) {
$this->cartTask();
return;
}
// Get shipping info
$shipping = array_map('trim', $_POST);
// make sure email address is valid
$email = \Hubzero\Utility\Validate::email($shipping['email']) ? $shipping['email'] : User::get('email');
// Format posted info
$details = Lang::txt('COM_STORE_SHIP_TO') . ':' . "\r\n";
$details .= $shipping['name'] . "\r\n";
$details .= Sanitize::stripAll($shipping['address']) . "\r\n";
$details .= Lang::txt('COM_STORE_COUNTRY') . ': ' . $shipping['country'] . "\r\n";
$details .= '----------------------------------------------------------' . "\r\n";
$details .= Lang::txt('COM_STORE_CONTACT') . ': ' . "\r\n";
if ($shipping['phone']) {
$details .= $shipping['phone'] . "\r\n";
}
$details .= $email . "\r\n";
$details .= '----------------------------------------------------------' . "\r\n";
$details .= Lang::txt('COM_STORE_DETAILS') . ': ';
$details .= $shipping['comments'] ? "\r\n" . Sanitize::stripAll($shipping['comments']) : 'N/A';
// Register a new order
$order = new Order($this->database);
$order->uid = User::get('id');
$order->total = $cost;
$order->status = '0';
// order placed
$order->ordered = $now;
$order->email = $email;
$order->details = $details;
// Store new content
if (!$order->store()) {
throw new Exception($order->getError(), 500);
}
// Get order ID
$objO = new Order($this->database);
$orderid = $objO->getOrderID(User::get('id'), $now);
if ($orderid) {
// Transfer cart items to order
foreach ($items as $itm) {
$orderitem = new OrderItem($this->database);
$orderitem->uid = User::get('id');
$orderitem->oid = $orderid;
$orderitem->itemid = $itm->itemid;
$orderitem->price = $itm->price;
$orderitem->quantity = $itm->quantity;
$orderitem->selections = $itm->selections;
// Save order item
if (!$orderitem->store()) {
throw new Exception($orderitem->getError(), 500);
}
}
// Put the purchase amount on hold
$BTL = new Teller(User::get('id'));
$BTL->hold($order->total, Lang::txt('COM_STORE_BANKING_HOLD'), 'store', $orderid);
$message = new \Hubzero\Mail\Message();
$message->setSubject(Config::get('sitename') . ' ' . Lang::txt('COM_STORE_EMAIL_SUBJECT_NEW_ORDER', $orderid));
$message->addFrom(Config::get('mailfrom'), Config::get('sitename') . ' ' . Lang::txt(strtoupper($this->_option)));
// Plain text email
$eview = new \Hubzero\Mail\View(array('name' => 'emails', 'layout' => 'confirmation_plain'));
$eview->option = $this->_option;
$eview->controller = $this->_controller;
$eview->orderid = $orderid;
$eview->cost = $cost;
$eview->shipping = $shipping;
$eview->details = $details;
$eview->items = $items;
$plain = $eview->loadTemplate(false);
//.........这里部分代码省略.........
示例13: main
/**
* main method
*
* Check for the existance of a tmp/autopilot_running file. If it exists - and is less than an hour
* old do not do anything to prevent the possibility of running autotest several times in parallel
* on the same files. If the file is more than an hour old delete it and continue.
* Delete the tmp/autopilot_stop file if it exists and being autopilot test/checking process.
*
* @return void
* @access public
*/
function main()
{
if (!$this->_registerPid()) {
$this->out('Unable to register Pid');
$this->_stop();
}
if (file_exists($this->params['working'] . DS . '.autotest')) {
include $this->params['working'] . DS . '.autotest';
}
if (!empty($this->params['notify'])) {
$this->settings['notify'] = $this->params['notify'];
}
if (!empty($this->params['mode'])) {
$this->settings['mode'] = $this->params['mode'];
}
$suffix = '';
if (!empty($this->settings['mode'])) {
$suffix = ' (' . $this->settings['mode'] . ' mode)';
}
Notify::$method = $this->settings['notify'];
$this->addHooks();
Notify::message('Autopilot Starting', 'in ' . APP_DIR . $suffix, 0, false);
$this->buildPaths();
$this->run();
}
示例14: annotateit
/**
* Processes file annotations
*
* @return void
*/
public function annotateit()
{
// Check permission
if (!$this->model->access('content')) {
throw new Exception(Lang::txt('ALERTNOTAUTH'), 403);
return;
}
// Get the file entity
$file = trim($this->subdir, '/') . '/' . trim(Request::getVar('item', ''));
$entity = Entity::fromPath($file, $this->connection->adapter());
// Grab annotations
$keys = Request::getVar('key', []);
$values = Request::getVar('value', []);
$metadata = [];
foreach ($keys as $idx => $key) {
$key = trim($key);
$value = trim($values[$idx]);
if (!empty($key) && !empty($value)) {
$metadata[$key] = $value;
}
}
// Look for plugins that know how to handle them
$plugins = Plugin::byType('metadata');
if (count($plugins) == 0) {
\Notify::message(Lang::txt('PLG_PROJECTS_FILES_ERROR_NO_ANNOTATION_PLUGINS'), 'error', 'projects');
} else {
// Send the data off to the plugins
$response = Event::trigger('metadata.onMetadataSave', [$entity, $metadata]);
if (empty($response)) {
\Notify::message(Lang::txt('PLG_PROJECTS_FILES_ANNOTATED_SUCCESS'), 'success', 'projects');
} else {
\Notify::message(Lang::txt('PLG_PROJECTS_FILES_ERROR_ANNOTATE_FAILED'), 'error', 'projects');
}
}
// Redirect to file list
$url = $this->model->link('files') . '&action=browse&connection=' . $this->connection->id;
$url .= $this->subdir ? '&subdir=' . urlencode($this->subdir) : '';
// Redirect
App::redirect(Route::url($url, false));
}
示例15: _quit
/**
* Quit project
*
* @return void, redirect
*/
protected function _quit()
{
$html = '';
// Incoming
$confirm = Request::getInt('confirm', 0, 'post');
// Instantiate project owner
$objO = $this->model->table('Owner');
// Check to make sure we are not deleting last manager
$onlymanager = 0;
if ($this->model->access('manager')) {
$managers = $objO->getIds($this->model->get('id'), $role = 1);
if (count($managers) == 1) {
$onlymanager = 1;
}
}
// Remove member from team if not owner & other managers exist
if ($confirm && !$onlymanager && !$this->model->access('owner')) {
$deleted = $objO->removeOwners($this->model->get('id'), array($this->_uid));
if ($deleted) {
$this->_msg = Lang::txt('PLG_PROJECTS_TEAM_MEMBER_QUIT_SUCCESS');
// Record activity
$aid = $this->model->recordActivity(Lang::txt('PLG_PROJECTS_TEAM_PROJECT_QUIT'), 0, '', '', 'team', 0);
// Sync with system group
$objO->sysGroup($this->model->get('alias'), $this->model->config('group_prefix', 'pr-'));
}
} else {
// Output HTML
$view = new \Hubzero\Plugin\View(array('folder' => 'projects', 'element' => 'team', 'name' => 'quit'));
$view->group = $this->model->groupOwner('id');
$view->onlymanager = $onlymanager;
$view->option = $this->_option;
$view->database = $this->_database;
$view->model = $this->model;
$view->uid = $this->_uid;
$view->config = $this->_config;
$view->msg = isset($this->_msg) ? $this->_msg : '';
$view->title = $this->_area['title'];
if ($this->getError()) {
$view->setError($this->getError());
}
return $view->loadTemplate();
}
// Pass error or success message
if ($this->getError()) {
\Notify::message($this->getError(), 'error', 'projects');
} elseif (!empty($this->_msg)) {
\Notify::message($this->_msg, 'success', 'projects');
}
App::redirect(Route::url('index.php?option=' . $this->_option));
return;
}