예제 #1
0
 public function save()
 {
     if (!$this->name == 'admin') {
         $this->addError('name', 'name error');
         return false;
     }
     if (!$this->password == 'admin') {
         $this->addError('password', 'pwd error');
         return false;
     }
     Monc::app()->user->login();
     return true;
 }
예제 #2
0
 public function save()
 {
     if (!$this->validate()) {
         return false;
     }
     if (!($info = Monc::app()->user->getState('info'))) {
         throw new RuntimeException('第二步的个人信息还没填写');
     }
     $model = new Request();
     $model->setAttributes($info);
     $model->setAttributes($this->getAttributes());
     if (!$model->save()) {
         $this->addErrors($model->getErrors());
         return false;
     }
     return true;
 }
예제 #3
0
 /**
  * 1. sessionid
  * 2. name
  */
 function init()
 {
     $this->session = Monc::app()->session;
 }
예제 #4
0
파일: App.php 프로젝트: alexyandy/monc-php
    {
        // existed
        if (in_array($path, $this->import_path_param)) {
            return substr($path, strrpos($path, '.') + 1);
        }
        $this->import_path_param[] = $path;
        $path = MONC . '../' . str_replace('.', DIRECTORY_SEPARATOR, $path);
        if (substr($path, -1) == '*') {
            $path = substr($path, 0, strlen($path) - 1);
        } else {
            $path .= '.php';
        }
        if (!file_exists($path)) {
            //debug_print_backtrace();
            return;
            //throw new RuntimeException('no such path: ' . $path);
        }
        if (is_dir($path)) {
            $d = opendir($path);
            while ($file = readdir($d)) {
                is_file($path . $file) && !is_link($path . $file) && preg_match('/\\.php$/', $file) && ($this->import[$file] = $path . $file);
            }
        } else {
            $file = substr($path, strrpos($path, '/') + 1);
            $this->import[$file] = $path;
        }
        return substr($path, strrpos($path, '/') + 1, -4);
    }
}
return Monc::app();
예제 #5
0
<?php

spl_autoload_register(function ($class) {
    if (!isset(Monc::app()->import[$class . '.php'])) {
        throw new Exception('not found class [' . $class . ']');
    }
    include Monc::app()->import[$class . '.php'];
});
예제 #6
0
 protected function createPageUrl($page)
 {
     return $this->getPagination()->createPageUrl(Monc::app()->controller, $page);
 }
예제 #7
0
 public function createWidget($className, $properties = array())
 {
     $widget = Monc::app()->getWidgetFactory()->createWidget($this, $className, $properties);
     $widget->init();
     return $widget;
 }
예제 #8
0
/**
 * @return App
 */
function app()
{
    return Monc::app();
}