private function AddErrorUrlElement() { $name = 'ErrorUrl'; $this->selectorError = new PageUrlSelector($name, Trans($this->Label($name)), $this->confirm->GetErrorUrl()); //$this->selectorError ->SetRequired($this->ErrorPrefix($name)); $this->Elements()->AddElement($name, $this->selectorError); }
/** * Adds the field for name field label */ private function AddNextUrlField() { $name = 'NextUrl'; $this->selectorNext = new PageUrlSelector($name, Trans($this->Label($name)), $this->register->GetNextUrl()); $this->selectorNext->SetRequired($this->ErrorPrefix($name)); $this->Elements()->AddElement($name, $this->selectorNext); }
/** * Creates the new field columnizer * @param BackendForm $form The form where the fields are added * @param int $maxColumns The maximum amount of allowed columns * @throws \Exception Raises an error in case the max Columns doesn't match the 12 columns grid */ function __construct(BackendForm $form, $maxColumns = 4) { $this->form = $form; if (12 % $maxColumns != 0) { throw new \Exception(Trans('Core.FieldColumnizer.Error.MaxColumns.MustDivide12')); } $this->maxColumns = (int) $maxColumns; $this->fields = array(); }
/** * Renders a specific checkbox * @param string $name * @return string */ protected function RenderCheckbox($name) { $checkbox = new Checkbox($this->namePrefix . $name); $class = new \ReflectionClass($this); $checkbox->SetLabel(Trans('Core.' . $class->getShortName() . '.' . $name)); if ($this->Value($name)) { $checkbox->SetChecked(); } $field = new CheckboxField($checkbox); return $field->Render(); }
private function HandleLoggedIn() { $nextUrl = $this->login->GetNextUrl(); if (!self::Guard()->Accessor()->IsUndefined()) { if ($nextUrl) { Response::Redirect($nextUrl); } else { throw new \Exception(Trans('BuiltIn.Login.Exception.AlreadyLoggedIn')); } } }
/** * Adds the user group field */ private function AddUserGroupField() { $name = 'UserGroup'; $field = new Select($name, ''); $field->AddOption('', Trans('Core.ContainerForm.NoGroup')); if ($this->container->Exists() && $this->container->GetUserGroup()) { $field->SetValue($this->container->GetUserGroup()->GetID()); } DBSelectUtil::AddUserGroupOptions($field); $this->AddField($field); }
private function AddTagNameField() { $name = 'TagName'; $select = new Select($name, $this->block->GetTagName()); $select->AddOption('', Trans('Core.PleaseSelect')); $values = BlockTag::AllowedValues(); foreach ($values as $value) { $select->AddOption($value, $value); } $this->AddField($select); $this->SetRequired($name); }
private function AddLanguageField() { $name = 'Language'; $lang = $this->user->GetLanguage(); $field = new Select($name, $lang ? $lang->GetID() : ''); $field->AddOption('', Trans('Core.PleaseSelect')); $sql = Access::SqlBuilder(); $tbl = Language::Schema()->Table(); $where = $sql->Equals($tbl->Field('IsBackendTranslated'), $sql->Value(true)); DBSelectUtil::AddLanguageOptions($field, $where); $this->AddField($field); $this->SetRequired($name); }
private function AddContainerField() { $name = 'Container'; $value = $this->container->Exists() ? $this->container->GetContainer()->GetID() : ''; $select = new Select($name, $value); $select->AddOption('', Trans('Core.PleaseSelect')); $sql = Access::SqlBuilder(); $tblContainer = Container::Schema()->Table(); $orderBy = $sql->OrderList($sql->OrderAsc($tblContainer->Field('Name'))); $containers = Container::Schema()->Fetch(false, null, $orderBy); foreach ($containers as $container) { $select->AddOption($container->GetID(), $container->GetName()); } $this->AddField($select); $this->SetRequired($name); }
private function performAction() { switch (Request::PostData('action')) { case 'insertIn': $this->InsertIn(); break; case 'insertAfter': $this->InsertAfter(); break; case 'delete': $this->BeforeDelete(); $this->Delete(); break; default: $this->AttachError(Trans('Core.JsonTree.Error.UndefinedAction')); } }
/** * Adds the module type option, if allowed * @param Select $select The select box * @param string $type The module type */ private function AddModuleTypeOption(Select $select, $type) { if ($type != 'BuiltIn-Container' || !Request::GetData('container') && Container::Schema()->Count() > 0) { $select->AddOption($type, Trans($type)); } }
private function ApplyFilters(array $filters, $value) { $isRaw = false; foreach ($filters as $filter) { if ($filter == 'raw') { $isRaw = true; continue; } if (!function_exists($filter)) { throw new \Exception(Trans('Core.Replacer.Error.FilterNotFound.Name_{0}', $filter)); } $value = $filter($value); } return $isRaw ? $value : Html($value); }
private function UnsetPage() { $this->SetJSFieldValue('#' . $this->prefix . 'Page', ''); if (!$this->pageOnly) { $this->SetJSFieldValue('#' . $this->prefix . 'Params', ''); $this->SetJSFieldValue('#' . $this->prefix . 'Fragment', ''); $this->SetJSHtml('#' . $this->prefix . 'Url', Trans('Core.PageUrlSelector.NoPage')); } else { $this->SetJSHtml('#' . $this->prefix . 'Name', Trans('Core.PageSelector.NoPage')); } }
/** * Gets a display name for backend issues, can be overridden * @return string The display name */ public function BackendName() { if ($this->ContentForm()) { $this->ContentForm()->ReadTranslations(); } return Trans($this->MyBundle() . '.' . $this->MyName() . '.BackendName'); }
protected function RenderWordingFields($noFieldset = false) { $result = ''; $wordings = $this->Wordings(); if (count($wordings) == 0) { return $result; } if (!$noFieldset) { $legend = Html(Trans('Core.ContentForm.Legend.Wordings')); $result .= "<fieldset><legend>{$legend}</legend>"; } $result .= '<div id="wording-table">'; foreach ($this->Wordings() as $name) { $result .= '<div class="wording-row">'; $result .= $this->RenderElement($this->WordingFieldName($name)); $result .= '</div>'; } $result .= '</div>'; if (!$noFieldset) { $result .= '</fieldset>'; } return $result; }
/** * The name of the cache file * @param FrontendModule $module * @return string The name of the cache file, it needn't exist yet * @throws \Exception Raises an error in case the cache key is not alphanumeric */ static function ContentCacheFile(FrontendModule $module) { $file = $module->Content()->GetID(); $cacheKey = $module->CacheKey(); if ($cacheKey) { if (!ctype_alnum($cacheKey)) { throw new \Exception(Trans('Core.CacheKey.Error.NotAlphaNumeric')); } $file .= '-' . $cacheKey; } $cacheFolder = Path::Combine(PHINE_PATH, 'Cache/Content'); return Path::AddExtension(Path::Combine($cacheFolder, $file), 'phtml'); }
function checkbackto($do_jump, $msg = '') { if ($msg == '') { $msg = Trans('Continue'); } $backto = Post('backto'); if ($backto == '') { $backto = Get('backto'); } if ($backto != '') { if ($do_jump) { echo oria_jumpto($backto, $msg); } else { echo oria_butlink($msg, $backto); } } }
private function AddNextUrlField() { $name = 'NextUrl'; $this->selectorNext = new PageUrlSelector($name, Trans($this->Label($name)), $this->login->GetNextUrl()); $this->Elements()->AddElement($name, $this->selectorNext); }
private function AddRedirectTargetSelector() { $name = 'RedirectTarget'; $this->selector = new PageUrlSelector($name, Trans($this->Label($name)), $this->page->GetRedirectTarget()); if ($this->page->Exists()) { $this->selector->DisablePage($this->page); } if ($this->Value('Type') == (string) PageType::RedirectPermanent() || $this->Value('Type') == (string) PageType::RedirectTemporary()) { $this->selector->SetRequired($this->ErrorPrefix($name)); } $this->Elements()->AddElement($name, $this->selector); }
private function AddTypeField() { $name = 'Type'; $value = 'PageItem'; if ($this->naviItem->Exists() && $this->naviItem->GetUrlItem()) { $value = 'UrlItem'; } $field = new Select($name, $value); $field->AddOption('PageItem', Trans('BuiltIn.NavigationItem.Type.PageItem')); $field->AddOption('UrlItem', Trans('BuiltIn.NavigationItem.Type.UrlItem')); $this->AddField($field); }
/** * Adds the smtp security field */ private function AddSmtpSecurityField() { $name = 'SmtpSecurity'; $field = new Select($name, $this->settings->GetSmtpSecurity()); $values = SmtpSecurity::AllowedValues(); foreach ($values as $value) { $field->AddOption($value, Trans("Core.SettingsForm.SmtpSecurity.{$value}")); } $this->AddField($field); }
/** * The bundle description */ final function Description() { return Trans(self::BundleName() . '.Manifest.Description'); }
/** * Gets the element with the given name * @param string $name * @return IFormElement */ public function GetElement($name) { $element = $this->Elements()->GetElement($name); if (!$element) { throw new \Exception(Trans('Core.Form.Error.ElementNotFound.Name_{0}', $name)); } return $element; }
$Money = $info['Money']; $Status = $info['Status']; $Attack = $info['Attack']; $Defense = $info['Defense']; $Hit = $info['Hit']; $Miss = $info['Miss']; $Move = $info['Move']; $MagicAttack = $info['MagicAttack']; $MagicDefense = $info['MagicDefense']; $Health = $info['Health']; $MaxHealth = $info['MaxHealth']; $Strength = Trans($Strength); $Agility = Trans($Agility); $Endurance = Trans($Endurance); $Magic = Trans($Magic); $TrumpAbility = Trans($TrumpAbility); $result = mysql_query("SELECT Title FROM achievementset WHERE id='{$TitleId}'"); $info2 = mysql_fetch_array($result); $Title = $info2[0]; echo '<p class=role>'; echo $Title . '   ' . $nam . '<br />经验:' . $Exp . '   等级:' . $Level . '   金钱:' . $Money . '   状态:' . $Status . '<br />'; echo '力量:' . $Strength . '   敏捷:' . $Agility . '   耐力:' . $Endurance . '   魔力:' . $Magic . '   宝具:' . $TrumpAbility . '<br />'; echo '攻击:' . $Attack . '   防御:' . $Defense . '   命中:' . $Hit . '   回避:' . $Miss . '   移动:' . $Move . '   属性攻击:' . $MagicAttack . '   属性防御:' . $MagicDefense . '<br />'; echo '生命值:' . $Health . '/' . $MaxHealth . '</p>'; } function Trans($number) { switch ($number) { case 0: return 'F'; case 1:
if ($active) { echo "<span style='color:green'>" . FA::icon('toggle-on')->x2(); } else { echo "<span style='color:gray'>" . FA::icon('toggle-off')->x2(); } echo "</span>"; }); Html::macro('featured', function ($active) { echo "<span style='color:black'>"; if ($active) { echo FA::icon('star'); } else { echo FA::icon('star-o'); } echo "</span>"; }); Html::macro('loadingImage', function () { echo "<span class='loadingImage'>"; echo FA::spin('circle-o-notch'); echo "</span>"; }); Html::macro('saveButton', function ($text = null) { echo "<button type=\"submit\" class=\"button\" onclick=\"\$(this).css('width','+=15');\">"; echo Html::loadingImage() . " "; if ($text == null) { echo Trans('admin.save'); } else { echo $text; } echo "</button>"; });