本文整理汇总了PHP中Goteo\Library\Text::groups方法的典型用法代码示例。如果您正苦于以下问题:PHP Text::groups方法的具体用法?PHP Text::groups怎么用?PHP Text::groups使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Goteo\Library\Text
的用法示例。
在下文中一共展示了Text::groups方法的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");
}
}
示例2: isset
* 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
echo $filter;
?>
" method="get">
<?php