示例#1
0
 /**
  * @ignore
  */
 public static function add($uAction)
 {
     Auth::checkRedirect('editor');
     $tModule = AutoModels::get(Panel::$module);
     $tAutoModel = new AutoModel($tModule['name']);
     $tFields = $tAutoModel->ddlGetFieldsForMethod('add');
     $tViewbag = array('module' => $tModule, 'postback' => Http::url('panel/' . Panel::$module . '/add'), 'fields' => array());
     if (Request::$method === 'post') {
         $tInput = array();
         foreach ($tFields as $tField) {
             $tInput[$tField['name']] = Request::post($tField['name']);
             if (!isset($tField['validation'])) {
                 continue;
             }
             // @todo add validation type as array key
             foreach ($tField['validation'] as $tFieldValidation) {
                 Validation::addRule($tField['name'])->add($tFieldValidation['type'], isset($tFieldValidation['params']) ? $tFieldValidation['params'] : array())->errorMessage($tFieldValidation['message']);
             }
         }
         if (Validation::validate($_POST)) {
             $tAutoModel->insert($tInput);
             Session::set('notification', array('info', 'ok-sign', 'Record added.'));
             Http::redirect('panel/' . Panel::$module);
             return;
         }
         Session::set('notification', array('error', 'remove-sign', Validation::getErrorMessages(true)));
     }
     foreach ($tFields as $tField) {
         if ($tField['type'] === 'enum') {
             $tTypes = array();
             foreach ($tField['valueList'] as $tValue) {
                 $tTypes[$tValue['name']] = $tValue['title'];
             }
             $tAttributes = array('name' => $tField['name'], 'class' => 'input-block-level input_' . $tField['type']);
             // if (!$tIsEdit) {
             //    $tAttributes['readonly'] = 'readonly';
             // }
             $tTag = '<p>' . I18n::_($tField['title']) . ': ' . Html::tag('select', $tAttributes, Html::selectOptions($tTypes, Request::post($tField['name'], null))) . '</p>';
         } else {
             $tAttributes = array('type' => 'text', 'name' => $tField['name'], 'value' => Request::post($tField['name'], ""), 'class' => 'input-block-level input_' . $tField['type']);
             // if (!$tIsEdit) {
             //    $tAttributes['readonly'] = 'readonly';
             // }
             $tTag = '<p>' . I18n::_($tField['title']) . ': ' . Html::tag('input', $tAttributes) . '</p>';
         }
         $tViewbag['fields'][] = array('data' => $tField, 'html' => $tTag);
     }
     Views::viewFile('{core}views/panel/models/form.php', $tViewbag);
 }
示例#2
0
    /**
     * @ignore
     */
    public static function exportJs()
    {
        $tReturn = <<<EOD
\$l.extend({
EOD;
        $tMethods = array();
        foreach (Config::get('larouxjs/methods', array()) as $tMethod) {
            $tSplit = explode('.', $tMethod);
            $tMethodName = array_pop($tSplit);
            // $tNamespace = Framework::$application->name . '\\Controllers\\' . implode('\\', $tSplit);
            $tPath = implode('/', $tSplit);
            if (!isset($tMethods[$tPath])) {
                $tMethods[$tPath] = array();
            }
            $tMethods[$tPath][] = $tMethodName;
        }
        if (count($tMethods) > 0) {
            foreach ($tMethods as $tMethodController => $tMethodActions) {
                $tLines = array();
                if (isset($tFirst)) {
                    $tReturn .= ',';
                } else {
                    $tFirst = false;
                }
                $tReturn .= PHP_EOL . "\t" . str_replace('/', '_', $tMethodController) . ': {' . PHP_EOL;
                foreach ($tMethodActions as $tMethodAction) {
                    $tLines[] = "\t\t" . $tMethodAction . ': function(values, successfnc, errorfnc, method) { if (typeof method == \'undefined\') method = \'post\'; $l.ajax[method](\'' . Http::url($tMethodController . '/' . $tMethodAction) . '\', values, successfnc, errorfnc); }';
                }
                $tReturn .= implode(',' . PHP_EOL, $tLines) . PHP_EOL . "\t" . '}';
            }
            $tReturn .= ',';
        }
        $tReturn .= <<<EOD
        translations:
EOD;
        $tReturn .= json_encode(self::$translations);
        $tReturn .= <<<EOD

});
EOD;
        return $tReturn;
    }
示例#3
0
    <title><?php 
echo I18n::_('Scabbia Framework: Docs');
?>
</title>
    <link rel="shortcut icon" href="<?php 
echo Http::url('scabbia-assets/favicon.ico');
?>
" type="image/x-icon" />

    <link type="text/css" href="<?php 
echo Http::url('scabbia.css?core,docs');
?>
" rel="stylesheet" media="all" />
    <script type="text/javascript" src="<?php 
echo Http::url('scabbia.js?core');
?>
"></script>
</head>
<body>
<script type="text/javascript">
    $l.contentBegin('main', '<?php 
echo $root;
?>
/');
</script>

<div id="page">
    <header id="pageTop">
        Scabbia Documentation
    </header>
示例#4
0
					<form>
						<img src="<?php 
echo Http::url('scabbia-assets/jquery.tablesorter/images/first.png');
?>
" class="first" />
						<img src="<?php 
echo Http::url('scabbia-assets/jquery.tablesorter/images/prev.png');
?>
" class="prev" />
						<input type="text" class="pagedisplay" readonly="readonly" />
						<img src="<?php 
echo Http::url('scabbia-assets/jquery.tablesorter/images/next.png');
?>
" class="next" />
						<img src="<?php 
echo Http::url('scabbia-assets/jquery.tablesorter/images/last.png');
?>
" class="last" />
						<select class="pagesize">
							<option value="10">10</option>
							<option selected="selected" value="25">25</option>
							<option value="50">50</option>
							<option value="100">100</option>
						</select>
					</form>
				</div>

			</div>
			<div class="bottomLine"></div>
			<div class="clear"></div>
		</td>
示例#5
0
echo String::encodeHtml(Html::tag('a', array('href' => 'https://github.com/eserozvataf/scabbia1'), 'https://github.com/eserozvataf/scabbia1'));
?>
" title="" data-original-title="<?php 
echo I18n::_('Scabbia Framework'), ' ', Framework::VERSION;
?>
"><?php 
echo I18n::_('Scabbia Framework');
?>
</a>
                        <div class="clearfix"></div>
                    </div>
                </div>
                <div id="pageTopLogo">
                    <div class="containerBox inner">
                        <a href="<?php 
echo Http::url('panel');
?>
"><img src="<?php 
echo $root, Config::get('panel/logo', '/scabbia-assets/panel/images/logo.png');
?>
" alt="" /></a>
                    </div>
                </div>
                <div id="pageTopMenu">
                    <div class="containerBox inner">
                        <nav>
                            <div id="pageTopNavbar" class="navbar navbar-static">
                                <div class="navbar-inner">
                                    <div class="container" style="width: auto;">
                                        <!-- <a class="brand" href="#">Panel</a> -->
                                        <ul class="nav" role="navigation">
示例#6
0
							<div id="placeholder">

								* model generator<br />
								* edit configuration files<br />
								* edit .htaccess/web.config<br />
								* add/remove/download extensions<br />
								* add/remove downloads<br />
								* edit database<br />
								* edit files<br />
								* <a href="<?php 
echo Http::url('panel/build');
?>
">build</a><br />
								* <a href="<?php 
echo Http::url('panel/purge');
?>
">purge</a><br />

							</div>
							<div class="clearfix"></div>
						</td>
						<td class="halfWidth">
							<h3><?php 
echo I18n::_('Statistics:');
?>
</h3>

							<div id="placeholderVisitors"></div>
							<div class="clearfix"></div>
						</td>
示例#7
0
?>
/');
        </script>

        <div class="block">

            <div class="block_head">
                <h2><?php 
echo I18n::_(Config::get('panel/loginTitle', 'Scabbia: Panel Login'));
?>
</h2>
            </div>

            <div class="block_content">
                <form method="POST" action="<?php 
echo Http::url('panel/' . Panel::LOGIN_MODULE_INDEX);
?>
">
                    <fieldset>
                        <div class="indent">
                            <?php 
Views::viewFile('{core}views/panel/sectionError.php');
?>

                            <label for="username"><?php 
echo I18n::_('Username:');
?>
</label>
                            <div class="input-prepend">
                                <span class="add-on"><i class="icon-user"></i></span>
                                <input id="username" type="text" class="text" name="username" placeholder="Enter username" />
示例#8
0
 /**
  * @ignore
  */
 public function render($uAction, array $uParams, array $uInput)
 {
     I18n::setLanguage('en');
     self::$modules = Config::get('panel/menuList', array());
     self::$modules[self::LOGIN_MODULE_INDEX] = array('actions' => array(self::DEFAULT_ACTION_INDEX => array('callback' => array(&$this, 'login'))));
     foreach (Config::get('panel/menuGeneratorList', array()) as $tGeneratorMethod) {
         call_user_func_array($tGeneratorMethod, array(&self::$modules));
     }
     self::$module = strlen($uAction) > 0 ? strtolower($uAction) : self::DEFAULT_MODULE_INDEX;
     if (!isset(self::$modules[self::$module])) {
         return false;
     }
     foreach (self::$modules as $tKey => $tMenu) {
         if (!isset($tMenu['title']) || isset($tMenu['role']) && !Auth::check($tMenu['role'])) {
             continue;
         }
         self::$menuItems[$tKey] = array($tKey === self::DEFAULT_MODULE_INDEX ? Http::url('panel') : Http::url('panel/' . $tKey), I18n::_($tMenu['title']), array());
         foreach ($tMenu['actions'] as $tMenuActionKey => $tMenuAction) {
             if (!isset($tMenuAction['title']) || isset($tMenuAction['role']) && !Auth::check($tMenuAction['role'])) {
                 continue;
             }
             if (isset($tMenuAction['before'])) {
                 if ($tMenuAction['before'] === 'separator') {
                     self::$menuItems[$tKey][self::MENU_ITEMS][] = '-';
                 }
             }
             if (isset($tMenuAction['customurl'])) {
                 $tUrl = $tMenuAction['customurl'];
             } elseif ($tMenuActionKey === self::DEFAULT_ACTION_INDEX) {
                 if ($tKey === self::DEFAULT_MODULE_INDEX) {
                     $tUrl = Http::url('panel');
                 } else {
                     $tUrl = Http::url('panel/' . $tKey);
                 }
             } else {
                 $tUrl = Http::url('panel/' . $tKey . '/' . $tMenuActionKey);
             }
             self::$menuItems[$tKey][self::MENU_ITEMS][] = array($tUrl, isset($tMenuAction['icon']) ? $tMenuAction['icon'] : 'minus', I18n::_($tMenuAction['title']));
             if (isset($tMenuAction['after'])) {
                 if ($tMenuAction['after'] === 'separator') {
                     self::$menuItems[$tKey][self::MENU_ITEMS][] = '-';
                 }
             }
         }
     }
     $tSubAction = count($uParams) > 0 ? array_shift($uParams) : self::DEFAULT_ACTION_INDEX;
     if (!isset(self::$modules[self::$module]['actions'][$tSubAction])) {
         return false;
     }
     return call_user_func_array(self::$modules[self::$module]['actions'][$tSubAction]['callback'], $uParams);
 }