本文整理汇总了PHP中Env::t方法的典型用法代码示例。如果您正苦于以下问题:PHP Env::t方法的具体用法?PHP Env::t怎么用?PHP Env::t使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Env
的用法示例。
在下文中一共展示了Env::t方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle_editor
public function handle_editor()
{
$this->question = Env::t('question', '');
$this->answer1 = Env::t('answer1', '');
$this->answer2 = Env::t('answer2', '');
return true;
}
示例2: handle_editor
public function handle_editor()
{
$this->title = Env::t('title', '');
$this->description = Env::t('description', '');
try {
$this->begin = new FrankizDateTime(Env::t('begin', $this->begin));
$this->end = new FrankizDateTime(Env::t('end', $this->end));
} catch (Exception $e) {
return false;
}
return true;
}
示例3: fillFields
function fillFields($json = false)
{
$fields = array('free' => '', 'hruid' => '', 'firstname' => '', 'lastname' => '', 'nickname' => '', 'cellphone' => '', 'nationalities' => '', 'promo' => '', 'studies' => '', 'sports' => '', 'courses' => '', 'binets' => '', 'frees' => '', 'room' => '', 'phone' => '', 'ip' => '', 'gender' => '');
foreach (array_keys($fields) as $field) {
if ($json) {
$fields[$field] = isset($json->{$field}) && trim($json->{$field}) != '' ? trim($json->{$field}) : false;
} else {
$fields[$field] = Env::t($field, '') != '' ? Env::t($field, '') : false;
}
}
return $fields;
}
示例4: handle_editor
public function handle_editor()
{
$this->title = Env::t('title', '');
$this->content = Env::t('news_content', '');
$this->begin = new FrankizDateTime(Env::t('begin'));
$this->end = new FrankizDateTime(Env::t('end'));
if (Env::has('image')) {
$image = new ImageFilter(new PFC_And(new IFC_Id(Env::i('image')), new IFC_Temp()));
$image = $image->get(true);
if (!$image) {
throw new Exception("This image doesn't exist anymore");
}
$image->select(FrankizImageSelect::caste());
$image->label($this->title);
$image->caste($this->target);
$this->image($image);
}
return true;
}
示例5: handler_qdj
public function handler_qdj($page)
{
$int = QDJ::interval();
$date_min = mktime(1, 0, 0, floor(($int['date_min']->format('n') - 1) / 2) * 2 + 1, 1, $int['date_min']->format('Y'));
$date_max = mktime(1, 0, 0, floor(($int['date_max']->format('n') + 1) / 2) * 2 + 1, 1, $int['date_max']->format('Y'));
$date = $date_min;
$begin_dates = array();
$end_dates = array();
while ($date < $date_max) {
$begin_dates[] = $date;
$date = strtotime('+2 months', $date);
$end_dates[] = strtotime('-1 day', $date);
}
$page->assign('results', $this->fetch_scores($begin_dates, $end_dates, Env::t('period', count($begin_dates) - 1)));
$page->assign('end_date', $end_dates);
$page->assign('begin_date', $begin_dates);
$page->assign('group_qdj', Group::from('qdj'));
$page->addCssLink('visualize.css');
$page->addCssLink('qdj.css');
$page->assign('title', "Classement QDJ");
$page->changeTpl('qdj/qdj.tpl');
}
示例6: handler_links_admin
function handler_links_admin($page)
{
if (!S::user()->perms()->hasFlag('admin')) {
return PL_FORBIDDEN;
}
$collec = Link::all();
$collec->select(LinkSelect::all());
$results = $collec->split('ns');
if (Env::has('modify')) {
$id = Env::i('id');
$link = $collec->get($id);
if ($link !== false) {
if (Env::has('image')) {
try {
$group = Group::from('partnership');
$group->select();
$image = new FrankizImage();
$image->insert();
$image->label($link->label());
$image->caste($group->caste('everybody'));
$image->image(FrankizUpload::v('image'));
$link->image($image);
} catch (Exception $e) {
$page->assign('err', $e->getMessage());
}
}
$link->label(Env::t('label'));
$link->link(Env::t('link'));
$link->description(Env::t('description'));
$link->comment(Env::t('comment'));
} else {
$err = 'Le lien modifié n\'existe plus.';
$page->assign('err', $err);
}
}
$page->addCssLink('links.css');
$page->assign('links', $results);
$page->assign('title', 'Administrer les liens');
$page->changeTpl('links/admin_links.tpl');
}
示例7: handler_send
function handler_send($page)
{
$page->changeTpl('emails/send.tpl');
$page->setTitle('Envoyer un email');
// action si on recoit un formulaire
if (Post::has('save')) {
if (!S::has_xsrf_token()) {
return PL_FORBIDDEN;
}
unset($_POST['save']);
if (trim(preg_replace('/-- .*/', '', Post::v('contenu'))) != "") {
Post::set('to_contacts', explode(';', Post::s('to_contacts')));
Post::set('cc_contacts', explode(';', Post::s('cc_contacts')));
$data = serialize($_POST);
XDB::execute('INSERT INTO email_send_save (uid, data)
VALUES ({?}, {?})
ON DUPLICATE KEY UPDATE data = VALUES(data)', S::user()->id('uid'), $data);
}
exit;
} else {
if (Env::v('submit') == 'Envoyer') {
S::assert_xsrf_token();
function getEmails($aliases)
{
if (!is_array($aliases)) {
return null;
}
$uf = new UserFilter(new UFC_Hrpid($aliases));
$users = $uf->iterUsers();
$ret = array();
while ($user = $users->next()) {
$ret[] = $user->forlife;
}
return join(', ', $ret);
}
$error = false;
foreach ($_FILES as &$file) {
if ($file['name'] && !PlUpload::get($file, S::user()->login(), 'emails.send', false)) {
$page->trigError(PlUpload::$lastError);
$error = true;
break;
}
}
if (!$error) {
XDB::execute("DELETE FROM email_send_save\n WHERE uid = {?}", S::user()->id());
$to2 = getEmails(Env::v('to_contacts'));
$cc2 = getEmails(Env::v('cc_contacts'));
$txt = str_replace('^M', '', Env::v('contenu'));
$to = str_replace(';', ',', Env::t('to'));
$subj = Env::t('sujet');
$from = Env::t('from');
$cc = str_replace(';', ',', Env::t('cc'));
$bcc = str_replace(';', ',', Env::t('bcc'));
$email_regex = '/^[a-z0-9.\\-+_\\$]+@([\\-.+_]?[a-z0-9])+$/i';
foreach (explode(',', $to . ',' . $cc . ',' . $bcc) as $email) {
$email = trim($email);
if ($email != '' && !preg_match($email_regex, $email)) {
$page->trigError("L'adresse email " . $email . ' est erronée.');
$error = true;
}
}
if (empty($to) && empty($cc) && empty($to2) && empty($bcc) && empty($cc2)) {
$page->trigError("Indique au moins un destinataire.");
$error = true;
}
if ($error) {
$page->assign('uploaded_f', PlUpload::listFilenames(S::user()->login(), 'emails.send'));
} else {
$mymail = new PlMailer();
$mymail->setFrom($from);
$mymail->setSubject($subj);
if (!empty($to)) {
$mymail->addTo($to);
}
if (!empty($cc)) {
$mymail->addCc($cc);
}
if (!empty($bcc)) {
$mymail->addBcc($bcc);
}
if (!empty($to2)) {
$mymail->addTo($to2);
}
if (!empty($cc2)) {
$mymail->addCc($cc2);
}
$files =& PlUpload::listFiles(S::user()->login(), 'emails.send');
foreach ($files as $name => &$upload) {
$mymail->addUploadAttachment($upload, $name);
}
if (Env::v('wiki') == 'text') {
$mymail->setTxtBody(wordwrap($txt, 78, "\n"));
} else {
$mymail->setWikiBody($txt);
}
if ($mymail->send()) {
$page->trigSuccess("Ton email a bien été envoyé.");
$_REQUEST = array('bcc' => S::user()->bestEmail());
PlUpload::clear(S::user()->login(), 'emails.send');
} else {
//.........这里部分代码省略.........
示例8: handler_admin
function handler_admin($page, $nid = false)
{
$news = News::fromId($nid);
if ($news !== false) {
$news->select(NewsSelect::news());
if (S::user()->hasRights($news->target()->group(), Rights::admin()) || S::user()->isWeb()) {
if (Env::has('modify') || Env::has('delete')) {
S::assert_xsrf_token();
}
if (Env::has('modify')) {
$news->title(Env::t('title'));
$news->content(Env::t('news_content'));
$news->begin(new FrankizDateTime(Env::t('begin')));
$news->end(new FrankizDateTime(Env::t('end')));
if (Env::has('reappear')) {
$news->removeReadFlags();
}
if (Env::has('image')) {
$image = new ImageFilter(new PFC_And(new IFC_Id(Env::i('image')), new IFC_Temp()));
$image = $image->get(true);
if (!$image) {
throw new Exception("This image doesn't exist anymore");
}
$image->select(FrankizImageSelect::caste());
$image->label($news->title());
$image->caste($news->target());
$news->image($image);
}
$page->assign('msg', "L'annonce a été modifiée.");
}
if (Env::has('delete')) {
$news->delete();
$page->assign('delete', true);
}
}
}
$page->assign('news', $news);
$page->assign('isEdition', true);
$page->assign('title', "Modifier l'annonce");
$page->addCssLink('validate.css');
$page->changeTpl('news/admin.tpl');
}
示例9: handler_aadmin
function handler_aadmin($page, $lfull = null)
{
if (!$this->get_lists_domain() || is_null($lfull)) {
return PL_NOT_FOUND;
}
$page->changeTpl('xnetlists/alias-admin.tpl');
require_once 'emails.inc.php';
list($local_part, $domain) = explode('@', $lfull);
if ($this->get_lists_domain() != $domain || !preg_match("/^[a-zA-Z0-9\\-\\.]*\$/", $local_part)) {
global $globals;
$page->trigErrorRedirect('Le nom de l\'alias est erroné.', $globals->asso('diminutif') . '/lists');
}
if (Env::has('add_member')) {
S::assert_xsrf_token();
if (add_to_list_alias(Env::t('add_member'), $local_part, $domain)) {
$page->trigSuccess('Ajout réussi.');
} else {
$page->trigError('Ajout infructueux.');
}
}
if (Env::has('del_member')) {
S::assert_xsrf_token();
if (delete_from_list_alias(Env::t('del_member'), $local_part, $domain)) {
$page->trigSuccess('Suppression réussie.');
} else {
$page->trigError('Suppression infructueuse.');
}
}
$page->assign('members', list_alias_members($local_part, $domain));
}
示例10: handle_editor
protected function handle_editor()
{
$this->titre = Env::v('pay_titre');
$this->site = Env::v('pay_site');
$this->montant = Env::t('pay_montant');
$this->montant_min = Env::i('pay_montant_min');
$this->montant_max = Env::i('pay_montant_max');
$this->msg_reponse = Env::v('pay_msg_reponse');
$this->public = Env::v('pay_public') == 'yes';
$this->rib_id = Env::v('pay_rib_id');
if ($this->rib_id) {
$res = XDB::query("SELECT owner FROM payment_bankaccounts WHERE id = {?}", $this->rib_id);
$this->rib_nom = $res->fetchOneCell();
} else {
$this->rib_nom = null;
}
return true;
}
示例11: handler_phd
function handler_phd($page, $promo = null, $validate = false)
{
$page->changeTpl('admin/phd.tpl');
$eduDegrees = DirEnum::getOptions(DirEnum::EDUDEGREES);
$eduDegrees = array_flip($eduDegrees);
// get the list of the years when phd students are supposed to finish but have not yet been flagged as completed
$promo_list = XDB::fetchColumn('SELECT DISTINCT(grad_year)
FROM profile_education
WHERE FIND_IN_SET(\'primary\', flags) AND NOT FIND_IN_SET(\'completed\', flags) AND degreeid = {?}
ORDER BY grad_year', $eduDegrees[Profile::DEGREE_D]);
// case when no promo was selected that is the admin/phd page
if (is_null($promo)) {
$page->assign('promo_list', $promo_list);
$page->assign('nothing', count($promo_list) == 0);
return;
}
// case when we want to add a list and we have data, that is admin/phd/bulk/validate
if ($promo == "bulk" && Post::has('people')) {
S::assert_xsrf_token();
$lines = explode("\n", Post::t('people'));
$separator = Env::t('separator');
foreach ($lines as $line) {
$infos = explode($separator, $line);
if (sizeof($infos) !== 2) {
$page->trigError("La ligne {$line} n'a pas été ajoutée : mauvais nombre de champs.");
continue;
}
$infos = array_map('trim', $infos);
// $info[0] is prenom.nom or hrid. We first try the hrid case, then we try over the possible promos.
// We trigger an error if the search was unsuccessful.
$user = User::getSilent($infos[0]);
if (is_null($user)) {
foreach ($promo_list as $promo_possible) {
$user = User::getSilent($infos[0] . '.d' . $promo_possible);
if (!is_null($user)) {
break;
}
}
if (is_null($user)) {
$page->trigError("La ligne {$line} n'a pas été ajoutée : aucun compte trouvé.");
continue;
}
}
if ($user->type !== 'phd') {
$page->trigError("La ligne {$line} n'a pas été ajoutée : le compte n'est pas celui d'un doctorant.");
continue;
}
$grad_year = $infos[1];
if (!$grad_year) {
$page->trigError("La ligne {$line} n'a pas été ajoutée : année de soutenance vide.");
continue;
}
$profile = $user->profile();
// We have the pid, we now need the id that completes the PK in profile_education.
$res = XDB::fetchOneCell('SELECT pe.id
FROM profile_education AS pe
WHERE FIND_IN_SET(\'primary\', pe.flags) AND NOT FIND_IN_SET(\'completed\', pe.flags)
AND pe.pid = {?}', $profile->id());
if (!$res) {
$page->trigError("Le profil " . $profile->hrid() . " a déjà une année de soutenance indiquée.");
continue;
}
// When we are here, we have the pid, id for profile_education table, and $grad_year. Time to UPDATE !
XDB::execute('UPDATE profile_education
SET flags = CONCAT(flags, \',completed\'), grad_year = {?}
WHERE pid = {?} AND id = {?}', $grad_year, $profile->id(), $res);
XDB::execute('UPDATE profile_display
SET promo = {?}
WHERE pid = {?}', 'D' . $grad_year, $profile->id());
$page->trigSuccess("Promotion de " . $profile->fullName() . " validée.");
}
$errors = $page->nb_errs();
if ($errors == 0) {
$page->trigSuccess("L'opération a été effectuée avec succès.");
} else {
$page->trigSuccess('L\'opération a été effectuée avec succès, sauf pour ' . ($errors == 1 ? 'l\'erreur signalée' : "les {$errors} erreurs signalées") . ' ci-dessus.');
}
} elseif ($validate) {
S::assert_xsrf_token();
$list = XDB::iterator('SELECT pe.pid, pd.directory_name
FROM profile_education AS pe
INNER JOIN profile_display AS pd ON (pe.pid = pd.pid)
WHERE FIND_IN_SET(\'primary\', pe.flags) AND NOT FIND_IN_SET(\'completed\', pe.flags)
AND pe.degreeid = {?} AND pe.grad_year = {?}', $eduDegrees[Profile::DEGREE_D], $promo);
while ($res = $list->next()) {
$pid = $res['pid'];
$name = $res['directory_name'];
if (Post::b('completed_' . $pid)) {
$grad_year = Post::t('grad_year_' . $pid);
XDB::execute('UPDATE profile_education
SET flags = CONCAT(flags, \',completed\'), grad_year = {?}
WHERE FIND_IN_SET(\'primary\', flags) AND pid = {?}', $grad_year, $pid);
XDB::execute('UPDATE profile_display
SET promo = {?}
WHERE pid = {?}', 'D' . $grad_year, $pid);
$page->trigSuccess("Promotion de {$name} validée.");
}
}
}
// case we are on a graduation year page, e.g. admin/phd/2007 or admin/phd/2007/validate
//.........这里部分代码省略.........
示例12: handle_editor
public function handle_editor()
{
$this->reason = Env::t('reason', '');
return true;
}
示例13: handler_group_admin
function handler_group_admin($page, $group = null)
{
$group = Group::fromId($group);
if ($group && (S::user()->hasRights($group, Rights::admin()) || S::user()->isWeb())) {
$group->select(GroupSelect::see());
$page->assign('group', $group);
if (Env::has('name') && Env::t('name') != '' && S::user()->isAdmin()) {
S::logger()->log("groups/admin", array("gid" => $group->id(), "old_name" => $group->name(), "new_name" => Env::t('name')));
$group->name(Env::t('name'));
}
if (Env::has('update') && S::user()->isAdmin()) {
$group->external(Env::has('external'));
$group->leavable(Env::has('leavable'));
$group->visible(Env::has('visible'));
}
if (Env::has('label')) {
$group->label(Env::t('label'));
}
if (Env::has('update')) {
$group->description(Env::t('description'));
$group->web(Env::t('web'));
$group->wikix(Env::t('wikix'));
$group->mail(Env::t('mail'));
}
if (Env::has('image')) {
$image = new ImageFilter(new PFC_And(new IFC_Id(Env::i('image')), new IFC_Temp()));
$image = $image->get(true);
if (!$image) {
throw new Exception("This image doesn't exist anymore");
}
$image->select(FrankizImageSelect::caste());
$image->label($group->label());
$image->caste($group->caste(Rights::everybody()));
$group->image($image);
}
if (S::user()->isWeb()) {
$nss = XDB::fetchColumn('SELECT ns FROM groups GROUP BY ns');
$page->assign('nss', $nss);
if (Env::has('ns')) {
S::logger()->log("groups/admin", array("gid" => $group->id(), "old_ns" => $group->ns(), "new_ns" => Env::t('ns')));
$group->ns(Env::t('ns'));
}
}
$promos = S::user()->castes()->groups()->filter('ns', Group::NS_PROMO);
$page->assign('promos', $promos);
$page->assign('title', 'Administration de "' . $group->label() . '"');
$page->addCssLink('groups.css');
$page->changeTpl('groups/admin.tpl');
} else {
$page->assign('title', "Ce groupe n'existe pas ou vous n'en êtes pas administrateur");
$page->changeTpl('groups/no_group.tpl');
}
}
示例14: handler_admin_member_new_ajax
function handler_admin_member_new_ajax($page)
{
pl_content_headers("text/html");
$page->changeTpl('xnetgrp/membres-new-search.tpl', NO_SKIN);
$users = array();
$same_email = false;
if (Env::has('login')) {
$user = User::getSilent(Env::t('login'));
if ($user && $user->state != 'pending') {
$users = array($user->id() => $user);
$same_email = true;
}
}
if (empty($users)) {
list($lastname, $firstname) = str_replace(array('-', ' ', "'"), '%', array(Env::t('nom'), Env::t('prenom')));
$cond = new PFC_And();
if (!empty($lastname)) {
$cond->addChild(new UFC_NameTokens($lastname, array(), false, false, Profile::LASTNAME));
}
if (!empty($firstname)) {
$cond->addChild(new UFC_NameTokens($firstname, array(), false, false, Profile::FIRSTNAME));
}
if (Env::t('promo')) {
$cond->addChild(new UFC_Promo('=', UserFilter::DISPLAY, Env::t('promo')));
}
$uf = new UserFilter($cond);
$users = $uf->getUsers(new PlLimit(30));
if ($uf->getTotalCount() > 30) {
$page->assign('too_many', true);
$users = array();
}
}
$page->assign('users', $users);
$page->assign('same_email', $same_email);
}
示例15: handle_editor
protected function handle_editor()
{
foreach (array('name', 'acronym', 'url', 'email', 'SIREN', 'NAF_code', 'tel', 'fax', 'address') as $field) {
$this->{$field} = Env::t($field) == '' ? null : Env::t($field);
}
foreach (array('AX_code', 'holdingid') as $field) {
$this->{$field} = Env::i($field) == 0 ? null : Env::i($field);
}
return true;
}