Beispiel #1
0
 protected function initUsedModel()
 {
     $pattern = "/(Model)\$/si";
     $vars = get_class_vars(get_class($this));
     $models = common\Utils::preg_grep_keys($pattern, $vars);
     if (!empty($models)) {
         foreach ($models as $model) {
             $this->{$model} = common\loadClass::getModel($model);
         }
     }
 }
Beispiel #2
0
 public function online()
 {
     $olUids = common\Utils::online();
     $idsArr = \array_keys($olUids);
     $where = "id in (" . implode(',', $idsArr) . ")";
     $userInfo = common\loadClass::getService('User')->fetchWhere($where);
     $result = array();
     foreach ($userInfo as $user) {
         $result[$user->id] = $user->hash();
     }
     return $result;
 }
Beispiel #3
0
 public function savereg()
 {
     $username = $this->getString($this->params, 'username');
     $password = $this->getString($this->params, 'password');
     $icon = $this->getString($this->params, 'icon', 'noface.jpg');
     $service = common\loadClass::getService('User');
     $result = $service->addUser($username, $password, $icon);
     if ($result) {
         return common\Utils::jump("main", "main", array("msg" => "注册成功"));
     }
     return common\Utils::showMsg("注册失败");
 }
Beispiel #4
0
 public function getOnlineList()
 {
     $olUids = common\Utils::online();
     if (empty($olUids)) {
         return array();
     }
     $idsArr = \array_keys($olUids);
     $where = "id in (" . implode(',', $idsArr) . ")";
     $userInfo = common\loadClass::getService('User')->fetchWhere($where);
     $result = array();
     foreach ($userInfo as $user) {
         $result[$user->id] = $user->hash();
     }
     $this->sendOne(Request::getFd(), common\Cmd::OLLIST, $result);
 }
Beispiel #5
0
 static function process()
 {
     if (!isset($_POST["submit"])) {
         return null;
     }
     $errors = LoginController::validate();
     if (sizeof($errors) > 0) {
         return $errors;
     }
     $isValidUser = SecurityManager::login($_POST["userName"], $_POST["password"]);
     if ($isValidUser) {
         Utils::Redirect('https://' . getenv('HTTP_HOST') . APP_FOLDER . '/views/solicitudesEntrega/index.php', false);
     }
     return array('Usuario inválido');
 }
Beispiel #6
0
 private function initUsedModel()
 {
     $pattern = "/(Model)\$/si";
     $vars = get_class_vars(get_class($this));
     $models = common\Utils::preg_grep_keys($pattern, $vars);
     if (!empty($models)) {
         foreach ($models as $model) {
             $this->{$model} = common\loadClass::getModel($model);
         }
     }
     //add Service
     $servicePattern = "/(Service)\$/si";
     $services = common\Utils::preg_grep_keys($servicePattern, $vars);
     if (!empty($services)) {
         foreach ($services as $service) {
             $this->{$service} = common\loadClass::getService($service);
         }
     }
 }
Beispiel #7
0
 static function logout()
 {
     $_SESSION["user"] = null;
     $root = (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'];
     Utils::Redirect($root . APP_FOLDER . SecuritySettings::pageAuthorization, false);
 }
 static function getDataEditInitBloqueos()
 {
     $data = new \stdClass();
     $data->bloqueoTypes = array();
     $data->user = SecurityManager::UserInfo();
     $data->user->type = SecurityManager::UserInfo()->roles[0]->name;
     $data->sucursales = array();
     if ($data->user->type == 'Gestor') {
         array_push($data->sucursales, ExternalDao::getSucursalById($data->user->sucursalId));
     } else {
         $data->sucursales = ExternalDao::getAllSucursales();
     }
     array_push($data->bloqueoTypes, BloqueoType::bloqueo);
     array_push($data->bloqueoTypes, BloqueoType::feriado);
     $result = new Response(new Result(), $data);
     return json_encode(Utils::utf8ize($result));
 }
 public function quack()
 {
     Utils::println("Quack!");
 }
<?php

require __DIR__ . '/../../vendor/autoload.php';
use Common\Utils;
use Strategy\Duck;
Utils::println("::Making specific duck");
$mallard = new Duck\MallardDuck();
$mallard->performQuack();
$mallard->performFly();
Utils::println("::Making model duck and changing its flying behavior");
$modelDuck = new Duck\ModelDuck();
$modelDuck->performFly();
$modelDuck->setFlyBehavior(new Duck\Behavior\FlyRocketPoweredBehavior());
$modelDuck->performFly();
Beispiel #11
0
 /**
  * @param array $data
  * @return array
  * @desc ctrl数据输出
  *       两个特殊变量 _view_mode: 强制指定view输出格式 (默认受 config中view_mode参数控制)
  *                  _tpl_file:  强制指定模版文件     (默认为 ctrl/method.php)
  */
 protected function getView($data = array())
 {
     if (common\Utils::isAjax()) {
         $data['_view_mode'] = 'Json';
         $data['code'] = 0;
         return $data;
     }
     return $data;
 }
 public function quack()
 {
     Utils::println("<< Silence >>");
 }
 public function fly()
 {
     Utils::println("I'm flying");
 }
 public function fly()
 {
     Utils::println("I'm flying with a rocket");
 }
 public function fly()
 {
     Utils::println("I can't fly");
 }
Beispiel #16
0
<?php

include TPL_PATH . 'header.php';
?>
<div class="container">

    <form class="form-signin" role="form" method="post" action="<?php 
echo \common\Utils::makeUrl('main', 'check');
?>
" />
        <h2 class="form-signin-heading">请登录</h2>
        <input type="text" name="username" class="form-control" placeholder="用户名" required autofocus>
        <input type="password" name="password" class="form-control" placeholder="密码" required>
        <button class="btn btn-lg btn-primary btn-block" type="submit">登录</button>
        <a href="<?php 
echo \common\Utils::makeUrl('main', 'reg');
?>
" class="btn btn-primary btn-lg active" role="button">注册</a>
    </form>

</div> <!-- /container -->
<?php 
include TPL_PATH . 'footer.php';
 public function quack()
 {
     Utils::println("Squeak");
 }
Beispiel #18
0
<?php

include 'header.php';
?>
<div class="container">

    <form class="form-signin" role="form" method="post" action="<?php 
echo \common\Utils::makeUrl('main/main', 'savereg');
?>
" />
        <h2 class="form-signin-heading">请注册</h2>
        <input type="text" name="username" class="form-control" placeholder="用户名" required autofocus>
        <input type="password" name="password" class="form-control" placeholder="密码" required>
        <button class="btn btn-lg btn-primary btn-block" type="submit">注册</button>
    </form>

</div> <!-- /container -->
<?php 
include 'footer.php';
 public function display()
 {
     Utils::println("I'm a real Mallard duck");
 }
Beispiel #20
0
 static function getDateEditInit()
 {
     $categorias = BaseDao::getAllCategorias();
     $sources = array();
     foreach ($categorias as $categoria) {
         $categoria->productos = BaseDao::getProductosByCategoriaId($categoria->id);
     }
     $sourcesAux = FormDao::getSources();
     foreach ($sourcesAux as $sourceAux) {
         $source = new \stdClass();
         $source->name = $sourceAux;
         $source->fields = FormDao::getFields($sourceAux);
         array_push($sources, $source);
     }
     $userFields = FormDao::getFields('User');
     $data = array("controlTypes" => Utils::GetEnumNames('\\dto\\controls\\ControlType'), "optionLayoutTypes" => Utils::GetEnumNames('\\dto\\controls\\OptionLayoutType'), "labelLayoutTypes" => Utils::GetEnumNames('\\dto\\controls\\LabelLayoutType'), "classWidths" => array(new Option('25%', ClassWidth::col_md_3), new Option('50%', ClassWidth::col_md_6), new Option('75%', ClassWidth::col_md_9), new Option('100%', ClassWidth::col_md_12)), "categorias" => $categorias, "sources" => $sources, "userFields" => $userFields);
     $result = new Response(new Result(), $data);
     return json_encode($result);
 }
Beispiel #21
0
    </div>
    <div class="chat_send">
        <div class="col-lg-6">
            <div class="input-group">
                <select class="form-control" id="sendTo" style="width:100px;">
                    <option value="0">全体</option>
                </select>
                <input type="text" id="msgContent" class="form-control">
      <span class="input-group-btn">
        <button class="btn btn-default" type="button" id="sendBtn" onclick="sendMsg()">发言</button>(ctrl+enter发送)
      </span>
            </div><!-- /input-group -->
        </div><!-- /.col-lg-6 -->
    </div>
    <div>协议自适应范例(socket和http自适应):<a href="<?php 
echo \common\Utils::makeUrl('chat/main', 'online');
?>
" target='_blank'>web方式查看在线用户</a>)</div>


</div> <!-- /container -->
<div id="chat_swf"></div>
<script src="<?php 
echo $static_url;
?>
js/jquery-1.9.1.js"></script>
<script src="<?php 
echo $static_url;
?>
js/jsocket.js"></script>
<script src="<?php 
Beispiel #22
0
 static function getDataReservasInit($id)
 {
     $data = new \stdClass();
     $data->user = SecurityDao::getUserById($id);
     $data->user->reservas = SecurityDao::getReservasByUserId($id);
     $data->currentUser = SecurityManager::UserInfo();
     $data->sucursales = ExternalDao::getAllSucursales();
     $result = new Response(new Result(), $data);
     return json_encode(Utils::utf8ize($result));
 }