Exemplo n.º 1
0
 /** 
  * 默认动作
  * Yaf支持直接把Yaf_Request_Abstract::getParam()得到的同名参数作为Action的形参
  * 对于如下的例子, 当访问http://yourhost/{&$APP_NAME&}/index/index/index/name/{&$AUTHOR&} 的时候, 你就会发现不同
  */
 public function indexAction($name = "Stranger")
 {
     $get = $this->getRequest()->getQuery("get", "default value");
     $model = new SampleModel();
     $this->getView()->assign("content", $model->selectSample());
     $this->getView()->assign("name", $name);
 }
Exemplo n.º 2
0
 public function testGetContext()
 {
     $context = $this->getContext();
     $model = new SampleModel();
     $model->initialize($context);
     $mContext = $model->getContext();
     $this->assertSame($mContext, $context);
 }
Exemplo n.º 3
0
 public function testBindableModel()
 {
     $properties = array('variable' => 'value', 'othervariable' => 'othervalue');
     include_once APP_DIR . '/model/SampleModel.php';
     $sample = new SampleModel();
     $sample->bind($properties);
     $this->assertEqual($sample->variable, 'value');
     $this->assertEqual($sample->othervariable, 'othervalue');
 }
Exemplo n.º 4
0
 /** 
  * 默认动作
  * Yaf支持直接把Yaf_Request_Abstract::getParam()得到的同名参数作为Action的形参
  * 对于如下的例子, 当访问http://yourhost/php/index/index/index/name/ 的时候, 你就会发现不同
  */
 public function indexAction($name = "Stranger")
 {
     //1. fetch query
     $get = $this->getRequest()->getQuery("get", "default value");
     //2. fetch model
     $model = new SampleModel();
     //3. assign
     $this->getView()->assign("content", $model->selectSample());
     $this->getView()->assign("name", $name);
     //4. render by Yaf, 如果这里返回FALSE, Yaf将不会调用自动视图引擎Render模板
 }
Exemplo n.º 5
0
 /** 
  * 默认动作
  * Yaf支持直接把Yaf_Request_Abstract::getParam()得到的同名参数作为Action的形参
  * 对于如下的例子, 当访问http://yourhost/yaf-php7/index/index/index/name/Mike 的时候, 你就会发现不同
  */
 public function indexAction(string $name = "Mike")
 {
     //1. fetch query
     $id = $this->getRequest()->getQuery('id');
     //2. fetch model
     $model = new SampleModel();
     //3. assign
     $this->getView()->assign("content", $model->selectSample());
     $this->getView()->assign("name", $name);
     $this->getView()->assign("id", $id);
     //4. render by Yaf, 如果这里返回FALSE, Yaf将不会调用自动视图引擎Render模板
     return TRUE;
 }
Exemplo n.º 6
0
 public function getAction()
 {
     $arrInput = $this->getRequest()->getQuery();
     $arrOuput = array();
     $arrOutput = SampleModel::all();
     return self::_returnJson(array('errno' => 0, 'data' => $arrOutput));
 }
Exemplo n.º 7
0
 /** 
  * 默认动作
  * Yaf支持直接把Yaf_Request_Abstract::getParam()得到的同名参数作为Action的形参
  * 对于如下的例子, 当访问http://yourhost/sample/index/index/index/name/wenbo-pc\wenbo 的时候, 你就会发现不同
  */
 public function indexAction($name = "Stranger")
 {
     //1. fetch query
     header("Content-type: text/html; charset=utf-8");
     $get = $this->getRequest()->getQuery("get", "default value");
     //2. fetch model
     $model = new SampleModel();
     // var_dump($model);
     //$this->redirect("index/login");
     // $echo=new echo();
     // $echo->echoname();
     //3. assign
     $this->getView()->assign("content", $model->selectSample());
     $this->getView()->assign("name", $name);
     //4. render by Yaf, 如果这里返回FALSE, Yaf将不会调用自动视图引擎Render模板
     return true;
 }
Exemplo n.º 8
0
 /**
  * 默认动作
  * Yaf支持直接把Yaf_Request_Abstract::getParam()得到的同名参数作为Action的形参
  * 对于如下的例子, 当访问http://yourhost/sample/index/index/index/name/chenzhidong 的时候, 你就会发现不同
  */
 public function indexAction($name = "Stranger")
 {
     //1. fetch query
     $get = $this->getRequest()->getQuery("get", "default value");
     //2. fetch model
     $model = new SampleModel();
     //setDatas
     $model->setDatas(array('email' => '*****@*****.**', 'nick' => 'nick', 'passwd' => '123456', 'ip_address' => Tools::getRemoteAddr()));
     //3. assign
     $this->_view->assign('content', $model->selectSample());
     $this->_view->assign('name', $name);
     //cache用法
     //Cache::getInstance()->get($key);
     //Cache::getInstance()->set($key);
     //4. render by Yaf, 如果这里返回FALSE, Yaf将不会调用自动视图引擎Render模板
     return true;
 }
Exemplo n.º 9
0
 public function testAction($name = "Stranger", $password = "")
 {
     echo $_SESSION['username'];
     //1. fetch query
     $get = $this->getRequest()->getQuery("get", "default value");
     //这个可以获取两种方式提交的name和value
     //print_r( $this->getRequest()->getParams($name,'ddd'));
     echo $this->getRequest()->getMethod();
     //2. fetch model
     $model = new SampleModel();
     //3. assign
     $this->getView()->assign("content", $model->selectSample());
     $this->getView()->assign("name", $name);
     //$this->display("index",array("name"=>ddddddddd));
     //4. render by Yaf, 如果这里返回FALSE, Yaf将不会调用自动视图引擎Render模板
     //$this->db = Yaf_Registry::get('_db');
     //print_r($this->db);
     return TRUE;
 }
Exemplo n.º 10
0
 public function getSample($sampleId)
 {
     if ($record = $this->record->findByPk($sampleId)) {
         return SampleModel::populateModel($record);
     }
 }
Exemplo n.º 11
0
 /**
  * @expectedException Resto\Exception\InvalidResourceException
  * @expectedExceptionMessage Model must be inside a namespace.
  * Without namespace
  */
 public function testInvalidNamespaceResourceResolve()
 {
     SampleModel::getResource();
 }
Exemplo n.º 12
0
 public function testEntityPath()
 {
     $model = new SampleModel();
     $this->assertEquals($model->getEntityPath(), 'sample_models');
 }
Exemplo n.º 13
0
<?php

Page::ignore_view();
if ('renew' == Request::get(1)) {
    die('11');
    Session::clear();
    Cookie::clear();
}
$m = new SampleModel();
if ($m->try_post()) {
    if ($m->pwd == Conf::$management_center_password) {
        Auth::im_admin('YYUC_sys');
        Redirect::to('index');
    } else {
        Session::once('logerr', '登录失败!');
    }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>YYUC开发管理中心</title>
		<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
		<script type="text/javascript">var yyuc_jspath = "/@system/";</script>
		<script type="text/javascript" src="/@system/js/jquery.js"></script>
		<script type="text/javascript" src="/@system/js/yyucadapter.js"></script>
		<!-- stylesheets -->
		<link rel="stylesheet" type="text/css" href="/@system/mg/reset.css" />
		<link rel="stylesheet" type="text/css" href="/@system/mg/style.css" media="screen" />
		<link id="color" rel="stylesheet" type="text/css" href="/@system/mg/colors/blue.css" />
		<style>
Exemplo n.º 14
0
 public function index()
 {
     $user = new SampleModel();
     $user->init();
 }
Exemplo n.º 15
0
 public function itShouldHydrateInstanceFindOne()
 {
     $this->conn->return_vals = array(array('sample_id' => 123, 'name' => 'Bob', 'is_true' => false));
     $model = SampleModel::find(123);
     $this->expect($model)->toBeInstanceOf('SampleModel');
     $this->expect($model->name)->toEqual('Bob');
     $this->expect($model->is_true)->toBe(false);
     $this->expect($model->sample_id)->toBe(123);
 }
Exemplo n.º 16
0
<?php

require '/home/ontopgames/db-conHive.php';
require "../models/SampleModel.php";
$sampleModel = new SampleModel($pdo);
$sampleList = $sampleModel->getAllSamples();
/** PHPExcel */
include '/home/ontopgames/public_html/328/beehive/XML/PHPExcel.php';
include '/home/ontopgames/public_html/328/beehive/XML/PHPExcel/IOFactory.php';
/** PHPExcel_Writer_Excel2007 */
include '/home/ontopgames/public_html/328/beehive/XML/PHPExcel/Writer/Excel2007.php';
// Create new PHPExcel object
$objPHPExcel = new PHPExcel();
// Set properties
$objPHPExcel->getProperties()->setCreator("");
$objPHPExcel->getProperties()->setLastModifiedBy("");
$objPHPExcel->getProperties()->setTitle("BeehiveSheet");
$objPHPExcel->getProperties()->setSubject("BeehiveSheet");
$objPHPExcel->getProperties()->setDescription("A list of behives and their mite information");
// Add some data
$i = 2;
//$downloadList = clone $sampleList;
$objPHPExcel->setActiveSheetIndex(0);
$objPHPExcel->getActiveSheet()->mergeCells('A1:B1');
$objPHPExcel->getActiveSheet()->mergeCells('C1:D1');
$objPHPExcel->getActiveSheet()->mergeCells('E1:F1');
$objPHPExcel->getActiveSheet()->mergeCells('G1:H1');
$objPHPExcel->getActiveSheet()->SetCellValue('A1', 'Hive_Id');
$objPHPExcel->getActiveSheet()->SetCellValue('C1', 'Collection Date');
$objPHPExcel->getActiveSheet()->SetCellValue('E1', 'Current Period');
$objPHPExcel->getActiveSheet()->SetCellValue('G1', 'Mite Count');
Exemplo n.º 17
0
 public function testAction()
 {
     $model = new SampleModel();
     echo $model->selectSample();
     return FALSE;
 }