Exemplo n.º 1
0
/**
 * Radio button.
 * @param string $data
 * @param string $value
 * @param bool $checked
 * @param string $extra
 * @return string
 */
function formRadio($data = '', $value = '', $checked = false, $extra = '')
{
    if (!is_array($data)) {
        $data = array('name' => $data);
    }
    $data['type'] = 'radio';
    return formCheckbox($data, $value, $checked, $extra);
}
Exemplo n.º 2
0
                ), ''
);
print formHint('Note: leave empty to generate a random password automatically');
print formFieldsetClose();
// -------------------------------------------------------------------------------
print formFieldsetOpen('', array(
  'id' => '-x-field-do_not_email_password'
));

print formCheckbox('do_not_email_password', '1', false);
print formLabel(__('Do not email the password'));
print formHint('Note: by default the password will be emailed, but you can prevent this by unchecking this option');
print formFieldsetClose();
// -------------------------------------------------------------------------------
print formFieldsetOpen('', array(
  'id' => '-x-field-is_enabled'
));

print formCheckbox('is_enabled', '1', true);
print formLabel(__('Activate this user?'));
print formFieldsetClose();
// -------------------------------------------------------------------------------
// Print submit
print formSubmit(array(
                   'class' => '-b-button',
                   'name'  => 'submit',
                   'value' => __('Create user')
                 ));
// Close form
print formClose();
?>
Exemplo n.º 3
0
 public function getFiles($type)
 {
     if ($type === "images") {
         $HTML = openUl("i-add-upload", "add-upload");
     } elseif ($type === "documents") {
         $HTML = openUl("d-add-upload", "add-upload");
     }
     $path = POST($this->px . "Dirbase") ? POST($this->px . "Dirbase") : $this->path;
     $path = POST($this->px . "Make") ? POST($this->px . "Dir") . slug(POST($this->px . "Dirname")) : $path;
     $files = $this->getPath($path);
     if (is_array($files)) {
         for ($i = 0; $i <= count($files) - 1; $i++) {
             if ($type === "images") {
                 $img = '\'<img src=\\\'' . _webURL . _sh . $path . $files[$i] . '\\\' alt=\\\'' . $files[$i] . '\\\' />\'';
                 if ($i < 9) {
                     $num = "0" . ($i + 1);
                 } else {
                     $num = $i + 1;
                 }
                 unset($attributes);
                 $attributes = array("name" => $this->px . "Library[]", "value" => $path . $files[$i]);
                 $attrs = array("onclick" => "javascript:insertHTML({$img});", "class" => "pointer", "title" => __(_("Insert Image")));
                 $HTML .= li(formCheckbox($attributes) . " " . small($num) . a(span("tiny-image tiny-search", "&nbsp;&nbsp;&nbsp;&nbsp;"), _webURL . _sh . $path . $files[$i], FALSE, array("title" => __(_("Preview image")))) . a(span("tiny-image tiny-add", "&nbsp;&nbsp;&nbsp;&nbsp;") . $files[$i], FALSE, FALSE, $attrs));
             } elseif ($type == "documents") {
                 $file = $this->Files->getFileInformation($files[$i]);
                 $img = '\'<a href=\\\'' . _webURL . _sh . $path . $files[$i] . '\\\' title=\\\'' . $files[$i] . '\\\'><img src=\\\'' . $file["icon"][0] . '\\\' alt=\\\'' . $files[$i] . '\\\' /></a>\'';
                 if ($i < 9) {
                     $num = "0" . ($i + 1);
                 } else {
                     $num = $i + 1;
                 }
                 $attributes = array("name" => $this->px . "Library[]", "value" => $path . $files[$i]);
                 unset($attrs);
                 $attrs = array("title" => __(_("Insert file")), "class" => "pointer", "onclick" => "javascript:insertHTML({$img});");
                 $span = span("tiny-image tiny-file", "&nbsp;&nbsp;&nbsp;&nbsp;");
                 $HTML .= li(formCheckbox($attributes) . " " . small($num) . a($span, _webURL . _sh . $path . $files[$i], FALSE, array("title" => __(_("Download file")))) . a(span("tiny-image tiny-add", "&nbsp;&nbsp;&nbsp;&nbsp;") . $files[$i], FALSE, FALSE, $attrs));
             }
         }
         $HTML .= closeUl();
     }
     return $HTML;
 }
Exemplo n.º 4
0
 public function build($categories, $ID = NULL, $type = "checkbox", $name = "categories", $class = NULL, $parent = 0, $URL = NULL, $hide = FALSE)
 {
     if (is_null($ID)) {
         if ($name === "parent") {
             $this->HTML = NULL;
         }
         if (!is_null($class)) {
             $this->HTML .= openUl(NULL, "categories-list");
         } else {
             $this->HTML .= openUl();
         }
         $i = 0;
         if (is_array($categories)) {
             foreach ($categories as $category) {
                 if (is_array($category)) {
                     if (isset($category["Situation"]) and $category["Situation"] === "Active" and (int) $category["ID_Parent"] === 0) {
                         $title = $category["Title"];
                         if ($type === "radio") {
                             if ($name === "parent" and $i === 0) {
                                 $input = formInput(array("name" => $name, "type" => "radio", "value" => 0));
                                 $link = a(span("bold", __("Principal")), FALSE, FALSE, array("title" => __("Principal")));
                                 $this->HTML .= li($input . $link);
                                 $i++;
                             }
                             $attrs = array("text" => getLanguage($category["Language"], TRUE), "name" => $name, "value" => $category["ID_Category"], "position" => "right");
                             $input = formRadio($attrs);
                             $link = a(span("bold", $title), FALSE, FALSE, array("title" => $title));
                             $this->HTML .= li($input . $link, TRUE);
                             if ($this->parents($categories, $category["ID_Category"])) {
                                 $this->build($categories, $category["ID_Category"], $type, $name);
                             }
                             $this->HTML .= li(FALSE);
                         } elseif ($type === "checkbox") {
                             if (isset($category["checked"]) and $category["checked"]) {
                                 $check = TRUE;
                             } elseif ((int) $category["ID_Category"] === $parent) {
                                 $check = TRUE;
                             } else {
                                 $check = FALSE;
                             }
                             $attrs = array("id" => $name, "text" => getLanguage($category["Language"], TRUE), "name" => $name . "[]", "value" => $category["ID_Category"], "position" => "right", "checked" => $check);
                             $input = formCheckbox($attrs);
                             $link = a(span("bold", $title), FALSE, FALSE, array("title" => $title));
                             $this->HTML .= li($input . $link, TRUE);
                             if ($this->parents($categories, $category["ID_Category"])) {
                                 $this->build($categories, $category["ID_Category"], $type, $name);
                             }
                             $this->HTML .= li(FALSE);
                         } else {
                             $link = a($title, $URL . $category["Slug"], FALSE, array("title" => $title));
                             $this->HTML .= li($link, TRUE);
                             if ($this->parents($categories, $category["ID_Category"])) {
                                 $this->build($categories, $category["ID_Category"], $type, $name);
                             }
                             $this->HTML .= li(FALSE);
                         }
                     }
                 }
             }
         }
         $this->HTML .= closeUl();
     } else {
         $this->HTML .= openUl();
         foreach ($categories as $category) {
             if ($category["Situation"] === "Active" and $category["ID_Parent"] === $ID) {
                 $title = $category["Title"];
                 if ($type === "radio") {
                     if (!$hide) {
                         if (isset($category["checked"]) and $category["checked"]) {
                             $check = TRUE;
                         } elseif ((int) $category["ID_Category"] === $parent) {
                             $check = TRUE;
                         } else {
                             $check = FALSE;
                         }
                         $attrs = array("id" => $name, "text" => getLanguage($category["Language"], TRUE), "name" => $name, "value" => $category["ID_Category"], "position" => "right", "checked" => $check);
                         $input = formRadio($attrs);
                         $link = a($title, FALSE, FALSE, array("title" => $title));
                         $this->HTML .= li($input . $link, TRUE);
                         if ($this->parents($categories, $category["ID_Category"]) === TRUE) {
                             $this->build($categories, $category["ID_Category"], $type, $name);
                         }
                         $this->HTML .= li(FALSE);
                     } else {
                         $link = a($title, FALSE, FALSE, array("title" => $title));
                         $this->HTML .= li(getLanguage($category["Language"], TRUE) . $link);
                         if ($this->parents($categories, $category["ID_Category"]) === TRUE) {
                             $this->build($categories, $category["ID_Category"], $type);
                         }
                         $this->HTML .= li(FALSE);
                     }
                 } elseif ($type === "checkbox") {
                     if (isset($category["checked"]) and $category["checked"]) {
                         $check = TRUE;
                     } elseif ((int) $category["ID_Category"] === $parent) {
                         $check = TRUE;
                     } else {
                         $check = FALSE;
                     }
                     $attrs = array("id" => $name, "text" => getLanguage($category["Language"], TRUE), "name" => $name . "[]", "value" => $category["ID_Category"], "position" => "right", "checked" => $check);
                     $input = formCheckbox($attrs);
                     $link = a($title, FALSE, FALSE, array("title" => $title));
                     $this->HTML .= li($input . $link, TRUE);
                     if ($this->parents($categories, $category["ID_Category"])) {
                         $this->build($categories, $category["ID_Category"], $type);
                     }
                     $this->HTML .= li(FALSE);
                 } else {
                     $link = a($title, $URL . $category["Slug"], FALSE, array("title" => $title));
                     $this->HTML .= li($link, TRUE);
                     if ($this->parents($categories, $category["ID_Category"])) {
                         $this->build($categories, $category["ID_Category"], $type);
                     }
                     $this->HTML .= li(FALSE);
                 }
             }
         }
     }
     $this->HTML .= closeUl();
     return $this->HTML;
 }
Exemplo n.º 5
0
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade ExidoEngine to newer
 * versions in the future. If you wish to customize ExidoEngine for your
 * needs please refer to http://www.exidoengine.com for more information.
 *
 * @license   http://www.exidoengine.com/license/gpl-3.0.html (GNU General Public License v3)
 * @author    ExidoTeam
 * @copyright Copyright (c) 2009 - 2013, ExidoEngine Solutions
 * @link      http://www.exidoengine.com/
 * @since     Version 1.0
 * @filesource
 *******************************************************************************/
// List actions menu
$view->action_menu = array('/page/action/create' => __('Create a new page'));
// Include menu code
$view->getView('layout/inc.list-action-menu-panel');
$helper->heading(__('Static pages'));
if ($view->item_list) {
    print tableOpen('-i-table -i-table-striped');
    print tableHead(array('', __('ID'), __('Page title'), __('Owner'), __('Group'), __('Added at'), __('Status'), __('Actions')));
    foreach ($view->item_list as $item) {
        print '<tr>' . '<td>' . formCheckbox('item[]', $item->entity_id, false, 'class="item-list-checkbox"') . '</td>' . '<td>' . $item->entity_id . '</td>' . '<td>' . eavFetchValue('title', $item->attributes) . '</td>' . '<td>' . eavFetchValue('owner_name', $item->attributes) . '</td>' . '<td>' . eavFetchValue('group_name', $item->attributes) . '</td>' . '<td>' . dateConvertSQL2Human(eavFetchValue('created_at', $item->attributes), Exido::config('global.date.format_long')) . '</td>' . '<td>' . eavFetchValue('is_enabled', $item->attributes, 'htmlStatus') . '</td>' . '<td>';
        $helper->a('page/action/edit/' . $item->entity_id, __('Edit'));
        $helper->a('page/action/remove/' . $item->entity_id, __('Remove'), 'remove');
        print '</td></tr>';
    }
    print tableClose();
} else {
    $helper->notifier(__('No pages created'));
}
Exemplo n.º 6
0
function eavFormCheckbox(Database_Mapper_Result $attributes)
{
    $output = formFieldsetOpen('', array('id' => '-x-field-' . $attributes->attribute_key));
    $checked = false;
    if (isset($attributes->value) and $attributes->value == true) {
        $checked = true;
    }
    $output .= formCheckbox($attributes->attribute_key, '1', $checked);
    $is_required = (bool) (isset($attributes->is_required) and (bool) $attributes->is_required == true);
    $output .= formLabel(__($attributes->description) . ($is_required ? '<sup>*</sup>' : ''));
    $output .= formFieldsetClose();
    return $output;
}