コード例 #1
0
ファイル: edit.php プロジェクト: icybee/module-sites
 protected function get_children()
 {
     global $core;
     $core->document->css->add(DIR . 'public/admin.css');
     $languages = $core->locale->conventions['localeDisplayNames']['languages'];
     asort($languages);
     $tz = ini_get('date.timezone');
     #
     $placeholder_tld = null;
     $placeholder_domain = null;
     $placeholder_subdomain = null;
     $parts = explode('.', $_SERVER['SERVER_NAME']);
     $parts = array_reverse($parts);
     $values = $this->values;
     if (!$values['tld'] && isset($parts[0])) {
         $placeholder_tld = $parts[0];
     }
     if (!$values['domain'] && isset($parts[1])) {
         $placeholder_domain = $parts[1];
     }
     if (!$values['subdomain'] && isset($parts[2])) {
         $placeholder_subdomain = $parts[2];
     }
     return array_merge(parent::get_children(), array('title' => new Text(array(Form::LABEL => 'Title', Element::REQUIRED => true)), 'admin_title' => new Text(array(Form::LABEL => 'Admin title', Element::DESCRIPTION => "Il s'agit du titre utilisé par l'interface d'administration.")), 'email' => new Text(array(Form::LABEL => 'Email', Element::REQUIRED => true, Element::VALIDATOR => array('Brickrouge\\Form::validate_email'), Element::DESCRIPTION => "The site's email is usually used as default sender email,\n\t\t\t\t\t\tbut can also be used as a contact address.")), 'subdomain' => new Text(array(Form::LABEL => 'Sous-domaine', Element::GROUP => 'location', 'size' => 16, 'placeholder' => $placeholder_subdomain)), 'domain' => new Text(array(Form::LABEL => 'Domaine', Text::ADDON => '.', Text::ADDON_POSITION => 'before', Element::GROUP => 'location', 'placeholder' => $placeholder_domain)), 'tld' => new Text(array(Form::LABEL => 'TLD', Text::ADDON => '.', Text::ADDON_POSITION => 'before', Element::GROUP => 'location', 'size' => 8, 'placeholder' => $placeholder_tld)), 'path' => new Text(array(Form::LABEL => 'Chemin', Text::ADDON => '/', Text::ADDON_POSITION => 'before', Element::GROUP => 'location', 'value' => trim($values['path'], '/'))), 'language' => new Element('select', array(Form::LABEL => 'Langue', Element::REQUIRED => true, Element::GROUP => 'i18n', Element::OPTIONS => array(null => '') + $languages)), 'nativeid' => $this->get_control_translation_sources($values), 'timezone' => new Widget\TimeZone(array(Form::LABEL => 'Fuseau horaire', Element::GROUP => 'i18n', Element::DESCRIPTION => "Par défaut, le fuseau horaire du serveur est\n\t\t\t\t\t\tutilisé (actuellement&nbsp;: <q>" . ($tz ? $tz : 'non défini') . "</q>).")), 'status' => new Element('select', array(Form::LABEL => 'Status', Element::GROUP => 'advanced', Element::OPTIONS => array(Site::STATUS_OK => 'Ok (online)', Site::STATUS_UNAUTHORIZED => 'Unauthorized', Site::STATUS_NOT_FOUND => 'Not found (offline)', Site::STATUS_UNAVAILABLE => 'Unavailable')))));
 }
コード例 #2
0
ファイル: edit.php プロジェクト: icybee/module-taxonomy-terms
 protected function lazy_get_children()
 {
     global $core;
     $vid_options = array(null => '') + $core->models['taxonomy.vocabulary']->select('vid, vocabulary')->pairs;
     /*
      * Beware of the 'weight' property, because vocabulary also define 'weight' and will
      * override the term's one.
      */
     return array_merge(parent::lazy_get_children(), array(Term::TERM => new TitleSlugCombo(array(Form::LABEL => 'Term', Element::REQUIRED => true)), Term::VID => new Element('select', array(Form::LABEL => 'Vocabulary', Element::OPTIONS => $vid_options, Element::REQUIRED => true))));
 }
コード例 #3
0
ファイル: edit.php プロジェクト: icybee/module-users
 protected function alter_actions(array $actions, array $params)
 {
     global $core;
     $actions = parent::alter_actions($actions, $params);
     $user = $core->user;
     $record = $this->record;
     if ($record && $record->uid == $user->uid && !$user->has_permission(Module::PERMISSION_ADMINISTER, $this->module)) {
         unset($actions[\Icybee\OPERATION_SAVE_MODE]);
     }
     return $actions;
 }
コード例 #4
0
ファイル: edit.php プロジェクト: icybee/module-nodes
 /**
  * Adds the `title`, `is_online`, `uid` and `siteid` elements.
  *
  * The `uid` and `siteid` elements are added according to the context.
  */
 protected function lazy_get_children()
 {
     $values = $this->values;
     return array_merge(parent::lazy_get_children(), [Node::TITLE => new TitleSlugCombo([Form::LABEL => 'title', Element::REQUIRED => true, TitleSlugCombo::T_NODEID => $values[Node::NID], TitleSlugCombo::T_SLUG_NAME => 'slug']), Node::UID => $this->get_control__user(), Node::SITEID => $this->get_control__site(), Node::IS_ONLINE => new Element(Element::TYPE_CHECKBOX, [Element::LABEL => 'is_online', Element::DESCRIPTION => 'is_online', Element::GROUP => 'visibility'])]);
 }