本文整理汇总了PHP中template::newRow方法的典型用法代码示例。如果您正苦于以下问题:PHP template::newRow方法的具体用法?PHP template::newRow怎么用?PHP template::newRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类template
的用法示例。
在下文中一共展示了template::newRow方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edit
/**
* MODULE : Édition d'une news */
public function edit()
{
// Erreur 404
if (!$this->getData([$this->getUrl(0), $this->getUrl(2)])) {
return false;
} elseif ($this->getPost('submit')) {
// Modifie la clef de la news si le titre a été modifié
$key = $this->getPost('title') ? $this->getPost('title', helper::URL) : $this->getUrl(2);
// Sauvegarde la date de création de la news
$date = $this->getData([$this->getUrl(0), $this->getUrl(2), 'date']);
// Si la clef à changée
if ($key !== $this->getUrl(2)) {
// Incrémente la nouvelle clef de la news pour éviter les doublons
$key = helper::increment($key, $this->getData($this->getUrl(0)));
// Supprime l'ancienne news
$this->removeData([$this->getUrl(0), $this->getUrl(2)]);
}
// Modifie la news ou en crée une nouvelle si la clef a changée
$this->setData([$this->getUrl(0), $key, ['title' => $this->getPost('title', helper::STRING), 'date' => $date, 'content' => $this->getPost('content')]]);
// Enregistre les données
$this->saveData();
// Notification de modification
$this->setNotification('News modifiée avec succès !');
// Redirige vers l'édition de la nouvelle news si la clef à changée ou sinon vers l'ancienne
helper::redirect('module/' . $this->getUrl(0) . '/edit/' . $key);
}
// Contenu de la page
self::$content = template::openForm() . template::openRow() . template::text('title', ['label' => 'Titre de la news', 'value' => $this->getData([$this->getUrl(0), $this->getUrl(2), 'title']), 'required' => 'required']) . template::newRow() . template::textarea('content', ['class' => 'editor', 'value' => $this->getData([$this->getUrl(0), $this->getUrl(2), 'content'])]) . template::newRow() . template::button('back', ['value' => 'Retour', 'href' => helper::baseUrl() . 'module/' . $this->getUrl(0), 'col' => 2]) . template::submit('submit', ['col' => 2, 'offset' => 8]) . template::closeRow();
template::closeForm();
}
示例2: index
/**
* MODULE : Configuration de la redirection
*/
public function index()
{
if ($this->getPost('submit')) {
$this->setData($this->getUrl(1), 'url', $this->getPost('url', helpers::URL));
$this->saveData();
$this->setNotification('Configuration du module enregistrée avec succès !');
helpers::redirect($this->getUrl());
}
self::$content = template::openForm() . template::openRow() . template::text('url', ['label' => 'URL de redirection', 'value' => $this->getData($this->getUrl(1), 'url')]) . template::newRow() . template::button('back', ['value' => 'Retour', 'href' => '?edit/' . $this->getUrl(1), 'col' => 2]) . template::submit('submit', ['col' => 2, 'offset' => 8]) . template::closeRow() . template::closeForm();
}
示例3: index
/**
* MODULE : Formulaire de contact
*/
public function index()
{
// Envoi du mail
if ($this->getPost('submit')) {
$mail = helpers::mail($this->getPost('subject', helpers::STRING), $this->getData($this->getUrl(0), 'mail'), $this->getPost('subject', helpers::STRING), $this->getPost('message', helpers::STRING));
if ($mail) {
$this->setNotification('Mail envoyé avec succès !');
} else {
$this->setNotification('Impossible d\'envoyer le mail !');
}
helpers::redirect($this->getUrl());
}
// Interface d'écriture de mail
self::$content = template::openForm() . template::openRow() . template::text('mail', ['label' => 'Adresse mail', 'required' => true, 'col' => 6]) . template::newRow() . template::text('subject', ['label' => 'Sujet', 'required' => true, 'col' => 6]) . template::newRow() . template::textarea('message', ['label' => 'Sujet', 'required' => true, 'col' => 7]) . template::newRow() . template::submit('submit', ['col' => 2]) . template::closeRow() . template::closeForm();
}
示例4: index
/** MODULE : Configuration de la redirection*/
public function index()
{
// Traitement du formulaire
if ($this->getPost('submit')) {
// Modifie l'URL de redirection
$this->setData([$this->getUrl(0), 'url', $this->getPost('url', helper::URL)]);
// Enregistre les données
$this->saveData();
// Notification de succès
$this->setNotification('URL de redirection enregistrée avec succès !');
// Redirige vers l'URL courante
helper::redirect($this->getUrl());
}
// Contenu de la page
self::$content = template::openForm() . template::openRow() . template::text('url', ['label' => 'URL de redirection', 'value' => $this->getData([$this->getUrl(0), 'url'])]) . template::newRow() . template::button('back', ['value' => 'Retour', 'href' => helper::baseUrl() . 'edit/' . $this->getUrl(0), 'col' => 2]) . template::submit('submit', ['col' => 2, 'offset' => 8]) . template::closeRow() . template::closeForm();
}
示例5: edit
/**
* MODULE : Édition d'une news
*/
public function edit()
{
if (!$this->getData($this->getUrl(1), $this->getUrl(3))) {
return false;
} elseif ($this->getPost('submit')) {
$key = $this->getPost('title') ? $this->getPost('title', helpers::URL) : $this->getUrl(3);
$date = $this->getData($this->getUrl(1), $this->getUrl(3), 'date');
if ($key !== $this->getUrl(3)) {
$key = helpers::increment($key, $this->getData($this->getUrl(1)));
$this->removeData($this->getUrl(1), $this->getUrl(3));
}
$this->setData($this->getUrl(1), $key, ['title' => $this->getPost('title', helpers::STRING), 'date' => $date, 'content' => $this->getPost('content')]);
$this->saveData();
$this->setNotification('News modifiée avec succès !');
helpers::redirect('module/' . $this->getUrl(1) . '/' . $this->getUrl(2) . '/' . $key);
}
self::$content = template::openForm() . template::openRow() . template::text('title', ['label' => 'Titre de la news', 'value' => $this->getData($this->getUrl(1), $this->getUrl(3), 'title'), 'required' => true]) . template::newRow() . template::textarea('content', ['class' => 'editor', 'value' => $this->getData($this->getUrl(1), $this->getUrl(3), 'content')]) . template::newRow() . template::button('back', ['value' => 'Retour', 'href' => '?module/' . $this->getUrl(1), 'col' => 2]) . template::submit('submit', ['col' => 2, 'offset' => 8]) . template::closeRow();
template::closeForm();
}
示例6: index
/** MODULE : Configuration du formulaire */
public function index()
{
// Traitement du formulaire
if ($this->getPost('submit')) {
// Configuration du module
$this->setData([$this->getUrl(0), 'config', ['mail' => $this->getPost('mail', helper::EMAIL), 'button' => $this->getPost('button', helper::STRING)]]);
// Génération des champs
$inputs = [];
foreach ($this->getPost('position') as $key => $value) {
$value = helper::filter($value, helper::INT);
// Supprime le premier élément (= le champ caché pour la copie)
if (!empty($value)) {
$inputs[] = ['position' => $value, 'name' => $this->getPost(['name', $key], helper::STRING), 'type' => $this->getPost(['type', $key], helper::STRING), 'values' => $this->getPost(['values', $key], helper::STRING), 'width' => $this->getPost(['width', $key], helper::INT)];
}
}
// Crée les champs
$this->setData([$this->getUrl(0), 'inputs', $inputs]);
// Enregistre les données
$this->saveData();
// Notification de succès
$this->setNotification('Formulaire enregistré avec succès !');
// Redirige vers l'URL courante
helper::redirect($this->getUrl());
}
// Liste des champs
if ($this->getData([$this->getUrl(0), 'inputs'])) {
// Liste les champs en les classant par position en ordre croissant
$inputs = helper::arrayCollumn($this->getData([$this->getUrl(0), 'inputs']), 'position', 'SORT_ASC');
// Crée l'affichage des champs en fonction
for ($i = 0; $i < count($inputs); $i++) {
self::$content .= template::openRow() . template::hidden('position[]', ['value' => $this->getData([$this->getUrl(0), 'inputs', $inputs[$i], 'position']), 'class' => 'position']) . template::button('move[]', ['value' => '↕', 'class' => 'move', 'col' => 1]) . template::text('name[]', ['placeholder' => 'Nom', 'value' => $this->getData([$this->getUrl(0), 'inputs', $inputs[$i], 'name']), 'col' => 3]) . template::select('type[]', self::$types, ['selected' => $this->getData([$this->getUrl(0), 'inputs', $inputs[$i], 'type']), 'class' => 'type', 'col' => 2]) . template::text('values[]', ['placeholder' => 'Liste des valeurs (valeur1,valeur2,...)', 'value' => $this->getData([$this->getUrl(0), 'inputs', $inputs[$i], 'values']), 'class' => 'values', 'col' => 3]) . template::select('width[]', self::$widths, ['selected' => (int) $this->getData([$this->getUrl(0), 'inputs', $inputs[$i], 'width']), 'col' => 2]) . template::button('delete[]', ['value' => '-', 'class' => 'delete', 'col' => 1]) . template::closeRow();
}
}
// Contenu de la page
self::$content = template::openForm() . template::title('Configuration') . template::openRow() . template::text('mail', ['label' => 'Recevoir à chaque validation un mail contenant les données saisies', 'value' => $this->getData([$this->getUrl(0), 'config', 'mail'])]) . template::text('button', ['label' => 'Personnaliser le texte du bouton', 'value' => $this->getData([$this->getUrl(0), 'config', 'button'])]) . template::closeRow() . template::title('Liste des champs') . template::div(['id' => 'copy', 'class' => 'hide', 'text' => template::openRow() . template::hidden('position[]', ['class' => 'position']) . template::button('move[]', ['value' => '↕', 'class' => 'move', 'col' => 1]) . template::text('name[]', ['placeholder' => 'Nom', 'col' => 3]) . template::select('type[]', self::$types, ['class' => 'type', 'col' => 2]) . template::text('values[]', ['placeholder' => 'Liste des valeurs (valeur1,valeur2,...)', 'class' => 'values', 'col' => 3]) . template::select('width[]', self::$widths, ['selected' => 12, 'col' => 2]) . template::button('delete[]', ['value' => '-', 'class' => 'delete', 'col' => 1]) . template::closeRow()]) . template::div(['id' => 'inputs', 'text' => self::$content]) . template::openRow() . template::button('add', ['value' => '+', 'col' => 1, 'offset' => 11]) . template::newRow() . template::button('back', ['value' => 'Retour', 'href' => helper::baseUrl() . 'edit/' . $this->getUrl(0), 'col' => 2]) . template::button('data', ['value' => 'Données saisies', 'href' => helper::baseUrl() . $this->getUrl() . '/data', 'col' => 2, 'offset' => 6]) . template::submit('submit', ['col' => 2]) . template::closeRow() . template::closeForm();
}
示例7: login
/**
* MODULE : Connexion
*/
public function login()
{
if ($this->getPost('submit')) {
if ($this->getPost('password', helpers::PASSWORD) === $this->getData('config', 'password')) {
$time = $this->getPost('time') ? 0 : time() + 10 * 365 * 24 * 60 * 60;
$this->setCookie($this->getPost('password'), $time);
helpers::redirect($this->getUrl());
} else {
$this->setNotification('Mot de passe incorrect !');
helpers::redirect($this->getUrl());
}
}
self::$title = 'Connexion';
self::$content = template::openForm() . template::openRow() . template::password('password', ['col' => 4]) . template::newRow() . template::checkbox('time', true, 'Me connecter automatiquement lors de mes prochaines visites.') . template::newRow() . template::submit('submit', ['value' => 'Me connecter', 'col' => 2]) . template::closeRow() . template::closeForm();
}
示例8: login
/** MODULE : Connexion */
public function login()
{
// Traitement du formulaire
if ($this->getPost('submit')) {
// Crée un cookie (de durée infinie si la case est cochée) si le mot de passe est correct
if ($this->getPost('password', helper::PASSWORD) === $this->getData(['config', 'password'])) {
$time = $this->getPost('time') ? 0 : time() + 10 * 365 * 24 * 60 * 60;
$this->setCookie($this->getPost('password'), $time);
} else {
$this->setNotification('Mot de passe incorrect !', true);
}
// Redirection vers l'URL courante
helper::redirect($this->getUrl());
}
// Contenu de la page
self::$title = helper::translate('Connexion');
self::$content = template::openForm() . template::openRow() . template::password('password', ['required' => 'required', 'col' => 4]) . template::newRow() . template::checkbox('time', true, 'Me connecter automatiquement à chaque visite') . template::newRow() . template::submit('submit', ['value' => 'Me connecter', 'col' => 2]) . template::closeRow() . template::closeForm();
}