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


PHP Text::getAll方法代码示例

本文整理汇总了PHP中Goteo\Library\Text::getAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Text::getAll方法的具体用法?PHP Text::getAll怎么用?PHP Text::getAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Goteo\Library\Text的用法示例。


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

示例1: process

 public static function process($action = 'list', $id = null, $filters = array())
 {
     // valores de filtro
     $groups = Text::groups();
     // metemos el todos
     \array_unshift($groups, Text::_('Todas las agrupaciones'));
     //@fixme temporal hasta pasar las agrupaciones a tabal o arreglar en el list.html.php
     // I dont know if this must serve in default lang or in current navigation lang
     $data = Text::getAll($filters, 'original');
     foreach ($data as $key => $item) {
         $data[$key]->group = $groups[$item->group];
     }
     switch ($action) {
         case 'list':
             return new View('view/admin/index.html.php', array('folder' => 'texts', 'file' => 'list', 'data' => $data, 'columns' => array('edit' => '', 'text' => Text::_('Texto'), 'group' => Text::_('Agrupación')), 'url' => '/admin/texts', 'filters' => array('filtered' => $filters['filtered'], 'group' => array('label' => Text::_('Filtrar por agrupación:'), 'type' => 'select', 'options' => $groups, 'value' => $filters['group']), 'text' => array('label' => Text::_('Buscar texto:'), 'type' => 'input', 'options' => null, 'value' => $filters['text']))));
             break;
         case 'edit':
             // gestionar post
             if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['update'])) {
                 $errors = array();
                 $id = $_POST['id'];
                 $text = $_POST['text'];
                 $data = array('id' => $id, 'text' => $_POST['text']);
                 if (Text::update($data, $errors)) {
                     Message::Info(Text::_('El texto ha sido actualizado'));
                     throw new Redirection("/admin/texts");
                 } else {
                     Message::Error(implode('<br />', $errors));
                 }
             } else {
                 //@TODO: this must get the text in the GOTEO_DEFAULT_LANG or it will be overwrited
                 $text = Text::getPurpose($id);
                 // Julian Canaves  23 nov 2013
                 // right now getPurpose gets the spanish text.
                 // In future this spanish text will be moved to the `Text` table
                 //  and the `Purpose` table will distribute to database text or to gettext
                 //  and there will be no hardcoded strings
                 //  and will be all happy, fun and joy
             }
             return new View('view/admin/index.html.php', array('folder' => 'texts', 'file' => 'edit', 'data' => (object) array('id' => $id, 'text' => $text), 'form' => array('action' => '/admin/texts/edit/' . $id, 'submit' => array('name' => 'update', 'label' => Text::_('Aplicar')), 'fields' => array('idtext' => array('label' => '', 'name' => 'id', 'type' => 'hidden', 'properties' => ''), 'newtext' => array('label' => Text::_('Texto'), 'name' => 'text', 'type' => 'textarea', 'properties' => 'cols="100" rows="6"')))));
             break;
         default:
             throw new Redirection("/admin");
     }
 }
开发者ID:isbkch,项目名称:Goteo,代码行数:45,代码来源:texts.php

示例2: isset

 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Affero General Public License for more details.
 *
 *  You should have received a copy of the GNU Affero General Public License
 *  along with Goteo.  If not, see <http://www.gnu.org/licenses/agpl.txt>.
 *
 */
use Goteo\Library\Text;
$bodyClass = 'admin';
// paginacion
require_once 'library/pagination/pagination.php';
// no cache para textos
define('GOTEO_ADMIN_NOCACHE', true);
$filter = $this['filter'];
$data = Text::getAll($this['filters'], $_SESSION['translator_lang']);
$pagedResults = new \Paginated($data, 20, isset($_GET['page']) ? $_GET['page'] : 1);
// valores de filtro
$idfilters = Text::filters();
$groups = Text::groups();
// metemos el todos
\array_unshift($idfilters, 'Todos los textos');
\array_unshift($groups, 'Todas las agrupaciones');
$filters = array('idfilter' => array('label' => 'Filtrar por tipo:', 'type' => 'select', 'options' => $idfilters, 'value' => $this['filters']['idfilter']), 'group' => array('label' => 'Filtrar por agrupación:', 'type' => 'select', 'options' => $groups, 'value' => $this['filters']['group']), 'text' => array('label' => 'Buscar texto:', 'type' => 'input', 'options' => null, 'value' => $this['filters']['text']));
?>
<!-- Filtro -->
<?php 
if (!empty($filters)) {
    ?>
<div class="widget board">
    <form id="filter-form" action="/translate/texts/list/<?php 
开发者ID:anvnguyen,项目名称:Goteo,代码行数:31,代码来源:list.html.php


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