当前位置: 首页>>代码示例>>PHP>>正文


PHP nt函数代码示例

本文整理汇总了PHP中nt函数的典型用法代码示例。如果您正苦于以下问题:PHP nt函数的具体用法?PHP nt怎么用?PHP nt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了nt函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: browse

 public function browse()
 {
     $oSubscriptionModel = new SubscriptionModel();
     $iTotal = $this->oSubscriptionModel->browse($this->httpRequest->get('looking'), true, $this->httpRequest->get('order'), $this->httpRequest->get('sort'), null, null);
     $oPage = new Page();
     $this->view->total_pages = $oPage->getTotalPages($iTotal, 30);
     $this->view->current_page = $oPage->getCurrentPage();
     $oBrowse = $this->oSubscriptionModel->browse($this->httpRequest->get('looking'), false, $this->httpRequest->get('order'), $this->httpRequest->get('sort'), $oPage->getFirstItem(), $oPage->getNbItemsByPage());
     unset($oPage);
     if (empty($oBrowse)) {
         $this->design->setRedirect(Uri::get('newsletter', 'admin', 'browse'));
         $this->displayPageNotFound(t('Sorry, Your search returned no results!'));
     } else {
         // Adding the static files
         $this->design->addCss(PH7_LAYOUT . PH7_TPL . PH7_TPL_NAME . PH7_SH . PH7_CSS, 'browse.css');
         $this->design->addJs(PH7_STATIC . PH7_JS, 'form.js');
         // Assigns variables for views
         $this->view->designSecurity = new Framework\Layout\Html\Security();
         // Security Design Class
         $this->view->dateTime = $this->dateTime;
         // Date Time Class
         $this->sTitle = t('Browse Subscribers');
         $this->view->page_title = $this->sTitle;
         $this->view->h2_title = $this->sTitle;
         $this->view->h3_title = nt('%n% Subscriber', '%n% Subscribers', $iTotal);
         $this->view->browse = $oBrowse;
     }
     $this->output();
 }
开发者ID:huangciyin,项目名称:pH7-Social-Dating-CMS,代码行数:29,代码来源:AdminController.php

示例2: browse

 public function browse()
 {
     $this->iTotalAdmins = $this->oAdminModel->searchAdmin($this->httpRequest->get('looking'), true, $this->httpRequest->get('order'), $this->httpRequest->get('sort'), null, null);
     $oPage = new Page();
     $this->view->total_pages = $oPage->getTotalPages($this->iTotalAdmins, 15);
     $this->view->current_page = $oPage->getCurrentPage();
     $oSearch = $this->oAdminModel->searchAdmin($this->httpRequest->get('looking'), false, $this->httpRequest->get('order'), $this->httpRequest->get('sort'), $oPage->getFirstItem(), $oPage->getNbItemsByPage());
     unset($oPage);
     if (empty($oSearch)) {
         $this->design->setRedirect(Uri::get(PH7_ADMIN_MOD, 'admin', 'browse'));
         $this->displayPageNotFound(t('Sorry, Your search returned no results!'));
     } else {
         // Adding the JS form file
         $this->design->addJs(PH7_STATIC . PH7_JS, 'form.js');
         // Assigns variables for views
         $this->view->designSecurity = new Framework\Layout\Html\Security();
         // Security Design Class
         $this->view->dateTime = $this->dateTime;
         // Date Time Class
         $this->sTitle = t('Browse Admins');
         $this->view->page_title = $this->sTitle;
         $this->view->h2_title = $this->sTitle;
         $this->view->h3_title = nt('%n% Admin', '%n% Admins', $this->iTotalAdmins);
         $this->view->browse = $oSearch;
     }
     $this->output();
 }
开发者ID:nsrau,项目名称:pH7-Social-Dating-CMS,代码行数:27,代码来源:AdminController.php

示例3: __construct

 public function __construct()
 {
     $aData = (new Newsletter())->sendMessages();
     if (!$aData['status']) {
         \PFBC\Form::setError('form_msg', Form::errorSendingEmail());
     } else {
         \PFBC\Form::setSuccess('form_msg', nt('%n% newsletters were sent successfully!', '%n% newsletter has been sent successfully', $aData['nb_mail_sent']));
     }
 }
开发者ID:huangciyin,项目名称:pH7-Social-Dating-CMS,代码行数:9,代码来源:MsgFormProcess.php

示例4: send

 protected function send()
 {
     $iNum = (new BirthdayCore())->sendMails();
     if ($iNum == 0) {
         echo t('No birthday today.');
     } else {
         echo nt('%n% email sent.', '%n% emails sent.', $iNum);
     }
 }
开发者ID:nsrau,项目名称:pH7-Social-Dating-CMS,代码行数:9,代码来源:BirthdayCoreCron.php

示例5: link

 /**
  * Get the link to comments.
  *
  * @param integer $iId
  * @param string $sTable
  * @return void
  */
 public static function link($iId, $sTable)
 {
     $oCommentModel = new CommentCoreModel();
     $iCommentNumber = $oCommentModel->total($iId, $sTable);
     unset($oCommentModel);
     echo '<p><a href="', Uri::get('comment', 'comment', 'add', "{$sTable},{$iId}"), '">', t('Add a comment'), '</a>';
     if ($iCommentNumber > 0) {
         $sCommentTxt = nt('Read Comment', 'Read the Comments', $iCommentNumber);
         echo ' - ', t('OR'), ' -  <a href="', Uri::get('comment', 'comment', 'read', $sTable . ',' . $iId), '">', $sCommentTxt, ' (', $iCommentNumber, ')</a> <a href="', Uri::get('xml', 'rss', 'xmlrouter', 'comment-' . $sTable . ',' . $iId), '"><img src="', PH7_URL_STATIC, PH7_IMG, 'icon/small-feed.png" alt="', t('RSS Feed'), '" /></a>';
     }
     echo '</p>';
 }
开发者ID:huangciyin,项目名称:pH7-Social-Dating-CMS,代码行数:19,代码来源:CommentDesignCore.php

示例6: index

 public function index()
 {
     $iTotalAds = (new AdsCoreModel())->total('AdsAffiliates');
     $oPage = new Page();
     $this->view->total_pages = $oPage->getTotalPages($iTotalAds, 10);
     $this->view->current_page = $oPage->getCurrentPage();
     unset($oPage);
     $this->sTitle = t('Banners');
     $this->view->page_title = $this->sTitle;
     $this->view->h1_title = $this->sTitle;
     $this->view->h3_title = nt('%n% Banner', '%n% Banners', $iTotalAds);
     $this->output();
 }
开发者ID:joswilson,项目名称:NotJustOK,代码行数:13,代码来源:AdsController.php

示例7: msgList

 public function msgList()
 {
     $this->iTotalMails = $this->oMailModel->search($this->httpRequest->get('looking'), true, $this->httpRequest->get('order'), $this->httpRequest->get('sort'), null, null);
     $this->view->total_pages = $this->oPage->getTotalPages($this->iTotalMails, 20);
     $this->view->current_page = $this->oPage->getCurrentPage();
     $oAllMsg = $this->oMailModel->search($this->httpRequest->get('looking'), false, $this->httpRequest->get('order'), $this->httpRequest->get('sort'), $this->oPage->getFirstItem(), $this->oPage->getNbItemsByPage());
     if (empty($oAllMsg)) {
         $this->displayPageNotFound(t('No messages found!'));
     } else {
         $this->design->addJs(PH7_STATIC . PH7_JS, 'divShow.js');
         $this->sTitle = t('Email List');
         $this->view->page_title = $this->sTitle;
         $this->view->h2_title = $this->sTitle;
         $this->view->h3_title = nt('%n% Mail Result!', '%n% Mails Result!', $this->iTotalMails);
         $this->view->msgs = $oAllMsg;
         $this->output();
     }
 }
开发者ID:nsrau,项目名称:pH7-Social-Dating-CMS,代码行数:18,代码来源:AdminController.php

示例8: index

 public function index()
 {
     // Add Stylesheet tooltip
     $this->design->addCss(PH7_LAYOUT . PH7_TPL . PH7_TPL_NAME . PH7_SH . PH7_CSS, 'tooltip.css');
     if ($this->httpRequest->getExists('country')) {
         // Get the country and city, limited to 50 characters and remove hyphens in too automatically insert the url.
         $this->registry->country = str_replace('-', ' ', substr($this->str->upperFirst($this->httpRequest->get('country')), 0, 50));
         $this->registry->city = $this->httpRequest->getExists('city') ? str_replace('-', ' ', substr($this->str->upperFirst($this->httpRequest->get('city')), 0, 50)) : '';
         // Set parameters Google Map
         $oMap = new Map();
         $oMap->setCenter($this->registry->country . ' ' . $this->registry->city);
         $oMap->setSize('800px', '690px');
         $oMap->setDivId('map');
         $oMap->setZoom(12);
         $oMap->addMarkerByAddress($this->registry->country . ' ' . $this->registry->city, t('Meet new people here!'));
         $oMap->generate();
         $this->view->map = $oMap->getMap();
         unset($oMap);
         $sCountryCode = $this->getCountryCode();
         // For User Model
         $this->view->userDesignModel = new UserDesignCoreModel();
         $this->view->country_code = $sCountryCode;
         $this->view->city = $this->registry->city;
         // Pagination
         $oPage = new Page();
         $iTotalUsers = (new UserCoreModel())->getGeoProfiles($sCountryCode, $this->registry->city, true, null, null, null);
         $this->view->total_pages = $oPage->getTotalPages($iTotalUsers, 20);
         $this->view->current_page = $oPage->getCurrentPage();
         $this->view->first_user = $oPage->getFirstItem();
         $this->view->nb_user_by_page = $oPage->getNbItemsByPage();
         // SEO Meta
         $this->view->page_title = t('Free online dating in %0% %1%, meet people, find friends. Single men & women in %2% %3%', $this->registry->country, $this->registry->city, $this->registry->country, $this->registry->city);
         $this->view->meta_description = t('Free online dating in %0% with single women & men. Personals, meet people & find friends in %1% on internet dating site. Find sweet love or sex dating and flirt in %2%, %3% with %site_name%', $this->registry->country, $this->registry->country, $this->registry->country, $this->registry->city);
         $this->view->meta_keywords = t('meeting woman, meeting man, %0%, %1%, meet people, networking, friends, communicate, meet online, online community, clubs, announces meeting, free dating, dating, %2% dating, communication, matrimonial meeting, sharing photos, flirt, finding friends, classifieds, personals, online, social networking', $this->registry->country, $this->registry->city, $this->registry->country);
         $this->view->h1_title = t('Meet new people in %0% %1%', '<span class="pH1">' . $this->registry->country . '</span>', '<span class="pH1">' . $this->registry->city . '</span>');
         $sMemberTxt = nt('%n% member', '%n% members', $iTotalUsers);
         $this->view->h3_title = t('%0% lives near %1% %2%', $sMemberTxt, $this->registry->country, $this->registry->city);
     } else {
         // Not found page
         Framework\Http\Http::setHeadersByCode(404);
         $this->view->error = t('Error, country is empty.');
     }
     $this->output();
 }
开发者ID:huangciyin,项目名称:pH7-Social-Dating-CMS,代码行数:44,代码来源:CountryController.php

示例9: index

 public function index()
 {
     $this->view->total_pages = $this->oPage->getTotalPages($this->iTotalVisitors, 10);
     $this->view->current_page = $this->oPage->getCurrentPage();
     $this->iTotalVisitors = $this->oVisitorModel->get($this->httpRequest->get('looking'), true, SearchCoreModel::LAST_VISIT, SearchCoreModel::DESC, null, null);
     $oVisitor = $this->oVisitorModel->get($this->httpRequest->get('looking'), false, SearchCoreModel::LAST_VISIT, SearchCoreModel::DESC, $this->oPage->getFirstItem(), $this->oPage->getNbItemsByPage());
     $this->view->user_views_setting = UserCore::auth() ? $this->oUserModel->getPrivacySetting($this->session->get('member_id'))->userSaveViews : '';
     if (empty($oVisitor)) {
         $this->sTitle = t('No Visitors found for the profile of "%0%"', $this->sUsername);
         $this->view->page_title = $this->sTitle;
         $this->view->h2_title = $this->sTitle;
         $this->view->error = t('Not found visitor.');
     } else {
         $this->sTitle = t('%0%\'s Visitors:', $this->sUsername);
         $this->view->page_title = $this->sTitle;
         $this->view->h2_title = $this->sTitle;
         $sVisitorTxt = nt('%n% Visitor', '%n% Visitors', $this->iTotalVisitors);
         $this->view->visitor_number = $sVisitorTxt;
         $this->view->visitors = $oVisitor;
     }
     $this->output();
 }
开发者ID:nsrau,项目名称:pH7-Social-Dating-CMS,代码行数:22,代码来源:VisitorController.php

示例10: showPostByProfile

 public function showPostByProfile()
 {
     $sUsername = $this->httpRequest->get('username');
     $this->view->username = $sUsername;
     $iId = (new UserCoreModel())->getId(null, $sUsername);
     $this->iTotalTopics = $this->oForumModel->totalTopics(null, $iId);
     $this->view->total_pages = $this->oPage->getTotalPages($this->iTotalTopics, 20);
     $this->view->current_page = $this->oPage->getCurrentPage();
     $this->view->topic_number = nt('%n% Topic:', '%n% Topics:', $this->iTotalTopics);
     $oTopics = $this->oForumModel->getPostByProfile($iId, 1, $this->oPage->getFirstItem(), $this->oPage->getNbItemsByPage());
     if (empty($oTopics)) {
         $this->sTitle = t('No found the forum post of %0%.', $sUsername);
         $this->_notFound(false);
         // Because the Ajax blocks profile, we can not put HTTP error code 404, so the attribute is "false"
     } else {
         $this->sTitle = t('%0%\'s Forum Posts', $sUsername);
         $this->view->page_title = $this->sTitle;
         $this->view->h2_title = $this->sTitle;
         $this->view->topics = $oTopics;
     }
     $this->output();
 }
开发者ID:huangciyin,项目名称:pH7-Social-Dating-CMS,代码行数:22,代码来源:ForumController.php

示例11: stat

 public function stat()
 {
     $iCountQueries = Db::queryCount();
     $sRequest = nt('Request', 'Requests', $iCountQueries);
     echo t('Time of the request: %0% | %1% %2% | Page executed in %3% seconds | Amount of memory allocated: %4%', Db::time(), $iCountQueries, $sRequest, Page::time(Registry::getInstance()->start_time, microtime(true)), memory_get_usage(true));
 }
开发者ID:joswilson,项目名称:NotJustOK,代码行数:6,代码来源:Design.class.php

示例12: count

 /**
  * @desc Count Comment with a HTML text.
  * @param integer $iId
  * @param string $sTable
  * @return string
  */
 public static function count($iId, $sTable)
 {
     $iCommentNumber = (new CommentCoreModel())->total($iId, $sTable);
     return nt('%n% Comment', '%n% Comments', $iCommentNumber);
 }
开发者ID:joswilson,项目名称:NotJustOK,代码行数:11,代码来源:CommentCore.php

示例13: __construct

 public function __construct()
 {
     parent::__construct();
     $this->_aFile = $_FILES['csv_file'];
     $sExtFile = $this->file->getFileExt($this->_aFile['name']);
     $sDelimiter = $this->httpRequest->post('delimiter');
     $sEnDelimiter = $this->httpRequest->post('enclosure');
     if ($sExtFile != 'csv' && $sExtFile != 'txt') {
         $sErrMsg = static::ERR_BAD_FILE;
     } elseif (!($rHandler = @fopen($this->_aFile['tmp_name'], 'rb'))) {
         $sErrMsg = static::ERR_BAD_FILE;
     } elseif (!($aFileData = @fgetcsv($rHandler, 0, $sDelimiter, $sEnDelimiter)) || !is_array($aFileData)) {
         $sErrMsg = static::ERR_BAD_FILE;
     }
     if (!empty($sErrMsg) && $sErrMsg == static::ERR_BAD_FILE) {
         $this->_removeTmpFile();
         \PFBC\Form::setError('form_import_user', t('Wrong file! Please select a valid CSV file containing data members.'));
         return;
         // Stop execution of the method.
     }
     /**
      * Default value...
      */
     $aGenderList = ['male', 'female', 'couple'];
     $sFiveChars = Various::genRnd($this->_aFile['name'], 5);
     $aTmpData = ['email' => 'pierrehenrysoriasanz' . $sFiveChars . '@hizup' . $sFiveChars . '.com', 'username' => 'Hizup' . $sFiveChars, 'password' => Various::genRnd(), 'first_name' => 'Alex' . $sFiveChars, 'last_name' => 'Rolli' . $sFiveChars, 'sex' => $aGenderList[mt_rand(0, 2)], 'match_sex' => $aGenderList[mt_rand(0, 2)], 'birth_date' => date('Y') - mt_rand(20, 40) . '-' . mt_rand(1, 12) . '-' . mt_rand(1, 28), 'country' => 'US', 'city' => 'Virginia', 'state' => 'Doswell', 'zip_code' => '23047', 'description' => 'Hi all!<br />How are you today?<br /> Bye ;)', 'website' => '', 'social_network_site' => '', 'ip' => Ip::get()];
     foreach ($aFileData as $sKey => $sVal) {
         // Clean the text to make comparisons easier...
         $sVal = strtolower(trim(str_replace(array('-', '_', ' '), '', $sVal)));
         // Test comparisons of strings and adding values in an array "$aTmpData"
         if ($sVal == 'username' || $sVal == 'login' || $sVal == 'user' || $sVal == 'nickname') {
             $aTmpData['username'] = $sKey;
         }
         if ($sVal == 'name' || $sVal == 'firstname') {
             $aTmpData['first_name'] = $sKey;
         }
         if ($sVal == 'lastname' || $sVal == 'surname') {
             $aTmpData['last_name'] = $sKey;
         }
         if ($sVal == 'matchsex' || $sVal == 'looking' || $sVal == 'lookingfor') {
             $aTmpData['match_sex'] = $sKey;
         }
         if ($sVal == 'sex' || $sVal == 'gender') {
             $aTmpData['sex'] = $sKey;
         }
         if ($sVal == 'email' || $sVal == 'mail') {
             $aTmpData['email'] = $sKey;
         }
         if ($sVal == 'desc' || $sVal == 'description' || $sVal == 'descriptionme' || $sVal == 'generaldescription' || $sVal == 'about' || $sVal == 'aboutme' || $sVal == 'bio' || $sVal == 'biography' || $sVal == 'comment') {
             $aTmpData['description'] = $sKey;
         }
         if ($sVal == 'country' || $sVal == 'countryid') {
             $aTmpData['country'] = $sKey;
         }
         if ($sVal == 'city' || $sVal == 'town') {
             $aTmpData['city'] = $sKey;
         }
         if ($sVal == 'state' || $sVal == 'district' || $sVal == 'province' || $sVal == 'region') {
             $aTmpData['state'] = $sKey;
         }
         if ($sVal == 'zip' || $sVal == 'zipcode' || $sVal == 'postal' || $sVal == 'postalcode') {
             $aTmpData['zip_code'] = $sKey;
         }
         if ($sVal == 'website' || $sVal == 'site' || $sVal == 'url') {
             $aTmpData['website'] = $sKey;
         }
         if ($sVal == 'birthday' || $sVal == 'birthdate' || $sVal == 'dateofbirth') {
             $aTmpData['birth_date'] = $this->dateTime->get($sKey)->date('Y-m-d');
         }
     }
     $iRow = 0;
     $oUser = new UserCore();
     $oUserModel = new UserCoreModel();
     $oExistsModel = new ExistsCoreModel();
     $oValidate = new Validate();
     while (($aFileData = fgetcsv($rHandler, 0, $sDelimiter, $sEnDelimiter)) !== false) {
         $aData[$iRow] = $aTmpData;
         // Set data by the default contents
         $sEmail = trim($aFileData[$aTmpData['email']]);
         if ($oValidate->email($sEmail) && !$oExistsModel->email($sEmail)) {
             $sUsername = trim($aFileData[$aTmpData['username']]);
             $sFirstName = trim($aFileData[$aTmpData['first_name']]);
             $sLastName = trim($aFileData[$aTmpData['last_name']]);
             $aData[$iRow]['username'] = $oUser->findUsername($sUsername, $sFirstName, $sLastName);
             $aData[$iRow]['first_name'] = $sFirstName;
             $aData[$iRow]['last_name'] = $sLastName;
             $aData[$iRow]['sex'] = trim($aFileData[$aTmpData['sex']]);
             $aData[$iRow]['match_sex'] = array(trim($aFileData[$aTmpData['match_sex']]));
             $aData[$iRow]['email'] = $sEmail;
             $aData[$iRow]['description'] = trim($aFileData[$aTmpData['description']]);
             $aData[$iRow]['country'] = trim($aFileData[$aTmpData['country']]);
             $aData[$iRow]['city'] = trim($aFileData[$aTmpData['city']]);
             $aData[$iRow]['state'] = trim($aFileData[$aTmpData['state']]);
             $aData[$iRow]['zip_code'] = trim($aFileData[$aTmpData['zip_code']]);
             $aData[$iRow]['website'] = trim($aFileData[$aTmpData['website']]);
             $aData[$iRow]['birth_date'] = trim($aFileData[$aTmpData['birth_date']]);
             $oUserModel->add(escape($aData[$iRow], true));
             $iRow++;
         }
     }
//.........这里部分代码省略.........
开发者ID:nsrau,项目名称:pH7-Social-Dating-CMS,代码行数:101,代码来源:ImportUserFormProcess.php

示例14: result

 public function result()
 {
     $this->iTotalGames = $this->oGameModel->search($this->httpRequest->get('looking'), true, $this->httpRequest->get('order'), $this->httpRequest->get('sort'), null, null);
     $this->view->total_pages = $this->oPage->getTotalPages($this->iTotalGames, 10);
     $this->view->current_page = $this->oPage->getCurrentPage();
     $oSearch = $this->oGameModel->search($this->httpRequest->get('looking'), false, $this->httpRequest->get('order'), $this->httpRequest->get('sort'), $this->oPage->getFirstItem(), $this->oPage->getNbItemsByPage());
     $this->setMenuVars();
     if (empty($oSearch)) {
         $this->sTitle = t('Sorry, Your search returned no results!');
         $this->_notFound();
     } else {
         $this->sTitle = t('Game - Your search returned');
         $this->view->page_title = $this->sTitle;
         $this->view->h2_title = $this->sTitle;
         $this->view->h3_title = nt('%n% Game Result!', '%n% Games Result!', $this->iTotalGames);
         $this->view->meta_description = t('Search - Free Games for Gamers, Flash Games, Free Online Games');
         $this->view->meta_keywords = t('search,game,free,flash,game site,flash game,games,gaming,online game');
         $this->view->games = $oSearch;
     }
     $this->manualTplInclude('index.tpl');
     $this->output();
 }
开发者ID:huangciyin,项目名称:pH7-Social-Dating-CMS,代码行数:22,代码来源:MainController.php

示例15: outstandingSection

 /**
  * Lists all media items that are outstanding, for the user to add
  * meta data such as title/description
  *
  * @return string
  */
 public function outstandingSection()
 {
     $this->setTitle(t('Manage uploaded files'));
     try {
         $category = $this->_model()->getCategory($this->_input->get('cid'));
         $resource = 'media-cat_upload_' . $category['id'];
         if (!$this->_acl->resourceExists($resource) || !$this->_acl->check($resource)) {
             throw new Module_NoPermission();
         }
         $cid = (int) $category['id'];
     } catch (Input_KeyNoExist $e) {
         $cid = null;
     } catch (Media_CategoryNoExist $e) {
         $this->_event->error(t('Media category does not exist'));
         $cid = null;
     }
     /**
      * Work out which URL to redirect back to, since if we've come from
      * the 'config' cntrlr, we want to redirect back to that always.
      */
     if (empty($_SESSION['previous_url']) || !empty($_SESSION['media']['fromConfigCntrlr'])) {
         $redirectUrl = $this->_router->makeUrl('media', 'config');
     } else {
         $parsedPreviousUrl = new Router_Url($_SESSION['previous_url']);
         if ($parsedPreviousUrl->module == 'media' && $parsedPreviousUrl->controller == 'config') {
             $_SESSION['media']['fromConfigCntrlr'] = true;
             $redirectUrl = $this->_router->makeUrl('media', 'config');
         } else {
             $redirectUrl = new Router_Url('media');
             if (isset($category['identifier'])) {
                 $redirectUrl->controller('cat')->section($category['identifier']);
             }
         }
     }
     // Get all outstanding media items
     $outstanding = $this->_model()->getOutstandingItems($cid);
     if (($count = count($outstanding)) == 0) {
         $this->_event->error(t('There are currently no outstanding media items'));
         return zula_redirect($redirectUrl);
     } else {
         $form = new View_form('manage/outstanding.html', 'media');
         $form->addElement('media/cid', $cid, 'cid', new Validator_Confirm($cid));
         $form->addElement('media/item', null, t('Items'), array(new Validator_Is('array'), new Validator_Length($count, $count)));
         if ($form->hasInput() && $form->isValid()) {
             /**
              * Update the title and description for all provided media items
              * however the ids must match the selecting outstanding items.
              */
             $validItemIds = array_keys($outstanding);
             // Validate the provided values
             $validatorName = new Validator_Length(1, 255);
             $validatorDesc = new Validator_Length(0, 1000);
             $successCount = 0;
             foreach ($form->getValues('media/item') as $key => $item) {
                 if (in_array($key, $validItemIds)) {
                     $valid = true;
                     if (($errorMsg = $validatorName->validate($item['name'])) !== true) {
                         $valid = false;
                         $this->_event->error(sprintf($errorMsg, t('Titles')));
                     }
                     if (($errorMsg = $validatorDesc->validate($item['desc'])) !== true) {
                         $valid = false;
                         $this->_event->error(sprintf($errorMsg, t('Descriptions')));
                     }
                     if ($valid) {
                         $this->_model()->editItem($key, $item['name'], $item['desc']);
                         unset($outstanding[$key]);
                         ++$successCount;
                     }
                 }
             }
             // Redirect back to the correct location
             if ($successCount > 0) {
                 $langStr = nt('Completed upload for 1 media item', 'Completed upload for %d media items', $successCount);
                 $this->_event->success(sprintf($langStr, $successCount));
             }
             if ($successCount == $count) {
                 unset($_SESSION['media']['fromConfigCntrlr']);
                 return zula_redirect($redirectUrl);
             }
         }
         $form->assign(array('CID' => $cid, 'OUTSTANDING' => $outstanding));
         return $form->getOutput();
     }
 }
开发者ID:jinshana,项目名称:tangocms,代码行数:91,代码来源:manage.php


注:本文中的nt函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。