Inheritance: extends Controller
Exemplo n.º 1
0
 public function init()
 {
     $l = new LayoutView();
     $lv = new LoginView();
     $lm = new LoginModel();
     $lc = new LogController($lv, $lm, $l);
     // short text variable too difficult to read? post me and i rename them to the original name
     // Lazy to write out a work in a hurry in Master Class
     $dg = new DiceGame();
     $d = new Dice();
     $c = new Cash($dg);
     $dv = new DiceView($d, $dg, $c);
     $pc = new PlayerController($dv, $d, $dg, $c);
     if ($lc->isLoggedin()) {
         $sv = new StartView();
         $l->render($sv);
         if ($sv->GetGame()) {
             $pc->CheckRoll();
             $l->render($dv);
         }
     } else {
         $lc->initLogin();
         $lc->renderLoginLayout();
     }
 }
Exemplo n.º 2
0
 public function init()
 {
     Doo::loadClassAt('Category', 'default');
     Doo::loadClassAt('City', 'default');
     LogController::$dataTableUrl = adminAppUrl('operation/user/dataTable');
     LogController::$addUrl = adminAppUrl('operation/user/add');
     LogController::$modUrl = adminAppUrl('operation/user/mod?id=');
     LogController::$delUrl = adminAppUrl('operation/user/del?id=');
     LogController::$city = '<select class="m-wrap" name="city" id="city-element"><option value="0">' . L('全部城市') . '</option>' . City::cateToOption($this->getUrlVar('city'), 1) . '</select>';
 }
 public static function run()
 {
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $user = new User($_POST, True);
         if ($user->getErrorCount() == 0) {
             LogController::run("In");
         } else {
             LoginView::show($user);
         }
     } else {
         LoginView::show(null);
     }
 }
Exemplo n.º 4
0
function crearSolicitudTarea($tipo, $id, $fecha_inicio, $fecha_fin, $titulo, $descripcion, $encargado, $prioridad, $proyeccion, $url)
{
    LogController::logWebServiceIn('Llamada a web service: ' . __FILE__ . ' - ' . __FUNCTION__, compact('tipo', 'id', 'fecha_inicio', 'fecha_fin', 'titulo', 'descripcion', 'encargado', 'prioridad', 'proyeccion', 'url'));
    $returnMessage = "";
    $handlerAttachmentCore = new AttachmentCore();
    $handlerRequestCore = new RequestCore();
    $handlerUserCore = new UserCore();
    $handlerFlowSettingsCore = new FlowSettingsCore();
    // Tomar datos de aprobador
    $flow = Flow::find(FLOW_TAREAS);
    $creador = User::find($encargado);
    if ($creador) {
        $jefe = User::find($creador->user_reports_to);
        if (!$jefe) {
            $jefe = User::find($flow->flow_administrator);
        }
        // Crear solicitud
        $request_flow = $flow->flow_id;
        $request_id = $handlerRequestCore->getLastGeneralRequestId() + 1;
        $inner_request_id = $handlerRequestCore->getLastGeneralRequestId($request_flow) + 1;
        $request_name = "Aprobación: " . $titulo;
        $request_description = "Aprobación de tarea: " . $descripcion;
        $request_createdby = $creador->user_id;
        $request_assignedto = $jefe->user_id;
        $handlerRequestCore->createNewRequest($request_id, $inner_request_id, $request_flow, $request_name, $request_description, $request_createdby, $request_assignedto);
        Tarea::create(["ef_id" => $request_id, "ext_id" => $id, "tipo" => $tipo, "titulo" => $titulo, "descripcion" => $descripcion, "encargado" => $request_createdby, "aprobador_1" => $request_assignedto, "aprobador_2" => "", "fecha_inicio" => $fecha_inicio, "fecha_fin" => $fecha_fin, "prioridad" => $prioridad, "proyeccion" => $proyeccion]);
        RequestMetadataCore::set($request_id, "APR-DOBLE-APROBACION", "No");
        RequestMetadataCore::set($request_id, "APR-APROBADO", "No");
        RequestMetadataCore::set($request_id, "APR-COMENTARIO", "");
        //Tomar archivo de campo url y adjuntar
        if ($url != '') {
            $tmpFileName = basename($url);
            file_put_contents($tmpFileName, fopen($url, 'r'));
            $filetype = FlowSettingsCore::get($request_flow, "APR_FILE_ADJUNTO");
            $handlerAttachmentCore->addAttachmentToRequest($request_id, $filetype, dirname(__FILE__) . "/" . $tmpFileName, $_SESSION["environment_path"], "admin", "Adjunto de tarea");
        }
    } else {
        $returnMessage = "ERROR: Usuario " . $encargado . " no existe en BPM. Imposible continuar";
    }
    return $returnMessage;
}
Exemplo n.º 5
0
 /**
  * 好友的动态
  */
 public function friend()
 {
     // 获取当前用户id
     $uid = $_SESSION['uid'];
     if ($uid) {
         $id = $uid;
         // 如果有uid 说明是访客
     } else {
         $id = $_SESSION['user']['id'];
     }
     // 获取当前用户的所有好友id
     $fid = D('Friend')->where(array('uid' => $id))->getField('fidlist', true);
     $fid = ltrim($fid[0], ',');
     $map = "uid in (" . $fid . ")";
     // 根据当前用户id 查找record 表
     $data = D('Record')->where($map)->order('addtime desc')->limit(10)->select();
     if ($data) {
         // 获取用户的头像和用户名
         $user = new MoodController();
         $list = $user->foreachGetUser($data, 'uid');
         // 会循环多次
         foreach ($list as $key => $value) {
             $userinfo[$key] = array_slice($value, -2, 2);
         }
         // 获取limit 条件
         $cond = $this->getLimitCondition($data);
         $cond = explode(',', $cond);
         $mood = $cond[0];
         if ($mood) {
             // 处理说说
             $say = D('Mood')->where($map)->order('addtime desc')->limit($mood)->select();
         }
         $log = $cond[1];
         if ($log) {
             // 处理日志
             $logData = D('LogCate')->where($map)->select();
             // 查询日志分类
             // 查当前用户的所有好友日志分类id
             $cate = new LogController();
             $map = $cate->getLogCateId($logData);
             $map = "cid in (" . $map . ")";
             $info = D('Log')->where($map)->order('addtime desc')->limit($log)->select();
         }
         $album = $cond[2];
         if ($album) {
             // 处理相册
             echo '不调用';
         }
         $data = $this->sort($say, $info);
         $count = count($data);
         foreach ($data as $key => $value) {
             $data[$key] = array_merge($value, $userinfo[$count - $key - 1]);
         }
     }
     $this->assign('list', $data);
     $this->display();
 }
Exemplo n.º 6
0
<?php

include "includer.php";
$url = parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH);
$urlPieces = split("/", $url);
if (count($urlPieces) < 2) {
    $control = "none";
} else {
    $control = $urlPieces[2];
}
switch ($control) {
    case "login":
        LoginController::run();
        break;
    case "logout":
        LogController::run("Out");
        break;
    case "signup":
        SignUpController::run();
        break;
    case "profile":
        ProfileController::run();
        break;
    case "map":
        MapController::run();
        break;
    default:
        HomeView::show();
}
Exemplo n.º 7
0
<?php

error_reporting(E_ALL);
require "../conf.php";
if (!isset($_POST['query'])) {
    $_POST['query'] = null;
}
if (!isset($_POST['offset'])) {
    $_POST['offset'] = null;
}
$lc = new LogController();
$lc->dispatch();
class LogController
{
    function LogController()
    {
        $this->table = "log";
        $this->queries = array();
    }
    function dispatch()
    {
        $start = microtime(true);
        $this->link = mysql_pconnect($GLOBALS["db_host"], $GLOBALS["db_user"], $GLOBALS["db_pass"]);
        if (!$this->link) {
            die("Unable to connect to MySQL");
        }
        $this->db = mysql_select_db($GLOBALS["db_db"], $this->link);
        if (!$this->db) {
            die("Unable to select DB.");
        }
        if (isset($_POST['count'])) {
 /**
  * Register page access log
  * @param string $pageId page id
  * @access public
  */
 public function registerPageLog($pageId)
 {
     $indexes = array(1 => "home.php", 2 => "storia.php", 3 => "menu.php", 4 => "cantina.php", 5 => "gallery.php", 6 => "eventi.php", 7 => "news.php", 8 => "raggiungerci.php", 9 => "contatti.php", 10 => "credits.php", 11 => "login.php", 12 => "error.php", 13 => "subscribe.php");
     include_once $_SERVER['DOCUMENT_ROOT'] . "resources/library/controller/LogController.php";
     $user = "";
     if (isset($_SESSION['user'])) {
         $user = $_SESSION['user'];
     } else {
         $user = "******";
     }
     $log = new LogController($user, $indexes[$pageId] . " requested and loaded", "pageAccess");
     $log->registerLog();
 }