Пример #1
0
 /**
  * @param Directory $parent
  * @param SplFileInfo $file
  * @return Content|Raw
  */
 public static function createContent(Directory $parent, SplFileInfo $file)
 {
     $name = static::getName($file->getPathname());
     $config = $parent->getConfig();
     if (!in_array($file->getExtension(), $config['valid_content_extensions'])) {
         $uri = static::removeSortingInformations($file->getFilename());
         $entry = new Raw($parent, $uri, $file);
         $entry->setTitle(str_replace('_', ' ', static::removeSortingInformations($name)));
         $entry->setName($name);
         return $entry;
     }
     $uri = static::removeSortingInformations($name);
     if ($config->isStatic()) {
         $uri .= '.html';
     }
     $entry = new Content($parent, $uri, $file);
     if ($entry->getUri() == $config['index_key']) {
         if ($parent instanceof Root) {
             $entry->setTitle($config['title']);
         } else {
             $entry->setTitle($parent->getTitle());
         }
     } else {
         $entry->setTitle(str_replace('_', ' ', static::removeSortingInformations($name)));
     }
     $entry->setName($name);
     return $entry;
 }
Пример #2
0
 public function testRender()
 {
     $raw_element = new Raw("Hello");
     $this->assertSame("Hello", $raw_element->render());
     $raw_element = new Raw('');
     $this->assertSame('', $raw_element->render());
     $raw_element = new Raw("\\'");
     $this->assertSame("\\'", $raw_element->render());
     $raw_element = new Raw("<a tag>");
     $this->assertSame("<a tag>", $raw_element->render());
 }
Пример #3
0
 public function testRefundGetSuccess()
 {
     $authData = ['data'];
     $result = new \stdClass();
     $this->refundClient->expects($this->once())->method('call')->with($this->equalTo('getRefunds'), $this->equalTo(['RefundAuth' => $authData]))->willReturn($result);
     $this->assertEquals($result, $this->model->refundGet($authData));
 }
Пример #4
0
Файл: Raw.php Проект: jankal/mvc
 /**
  * @return void
  */
 public static function go()
 {
     self::$used = true;
     $msqlo = new MySQLi(app::get('mysql')->host, app::get('mysql')->user, app::get('mysql')->password, app::get('mysql')->database);
     \DI::addInstance($msqlo);
     $modelob = new \Observer\ModelObserver();
     \DI::addInstance($modelob);
     \StartupAll::startup();
 }
Пример #5
0
 public function listen()
 {
     set_time_limit(0);
     $rows = Raw::Later()->where(['when', '<', time()])->cursor();
     foreach ($rows as $row) {
         $closure = eval('return ' . $row['code'] . ';');
         $args = unserialize($row['arguments']);
         call_user_func_array($closure, $args);
         Raw::Later()->find((int) $row['id'])->delete();
     }
 }
Пример #6
0
 private function isDue($class, $method, $when)
 {
     $next = Crontab::factory($when)->getNextRunDate()->getTimestamp();
     $row = Raw::ScheduleTask()->where(['class', '=', $class])->where(['method', '=', $method])->first(true);
     if (!$row) {
         $row = Raw::ScheduleTask()->create(['class' => $class, 'method' => $method, 'next' => (int) $next])->save();
     } else {
         if ($row->next <= time()) {
             $row->setNext($next)->save();
             return true;
         }
     }
     return false;
 }
Пример #7
0
 /**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id the ID of the model to be updated
  */
 public function actionUpdate($id)
 {
     $model = $this->loadModel($id);
     $modelRaws = Raw::model()->findAll();
     $modelRecipeRaw = new RecipeRaw();
     $modelIngredients = RecipeRaw::model()->findAllByAttributes(array("RecipeID" => $model->ID));
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Recipe'])) {
         $model->attributes = $_POST['Recipe'];
         if ($model->save()) {
             $this->redirect(array('admin'));
         }
     }
     $this->render('update', array('model' => $model, 'modelRaws' => $modelRaws, 'modelRecipeRaw' => $modelRecipeRaw, 'modelIngredients' => $modelIngredients));
 }
Пример #8
0
<?php

require_once 'autoload.php';
$logger = new \Logger\MainLogger();
$logger->addLoggers(new \Logger\EmailLogger());
\App::mode('raw');
DI::addInstance($logger);
\Service::init();
\Service::add("Cron\\Crontab");
\Service::add('GlobalEvents');
\Raw::go();
Пример #9
0
 public function __construct($value, $alias = '', array $bindings = [])
 {
     parent::__construct($value, $bindings);
     $this->alias = (string) $alias;
 }
Пример #10
0
echo $form->labelEx($model, 'Date');
?>
		<?php 
$this->widget('zii.widgets.jui.CJuiDatePicker', array('model' => $model, 'attribute' => 'Date', 'value' => $model->Date, 'options' => array('changeYear' => true, 'yearRange' => '1930', 'language' => 'es', 'dateFormat' => 'yy-mm-dd', 'monthNames' => array("Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"), 'monthNamesShort' => array("Ene", "Feb", "Mar", "Abr", "May", "Jun", "Jul", "Ago", "Sep", "Oct", "Nov", "Dic"), 'dayNames' => array("Domingo", "Lunes", "Martes", "Miercoles", "Jueves", "Viernes", "Sabado"), 'dayNamesMin' => array('Do', 'Lu', 'Ma', 'Mi', 'Ju', 'Vi', 'Sa'), 'defaultDate' => $model->Date), 'htmlOptions' => array('placeholder' => date("Y-m-d"))));
?>
		<?php 
echo $form->error($model, 'Date');
?>
	</div>
	
	<div class="row" style="float:left;margin-left:50px;">
		<?php 
echo $form->labelEx($model, 'RawID');
?>
		<?php 
echo $form->dropDownList($model, 'RawID', CHtml::listData(Raw::model()->findAll(), 'ID', 'Name'), array('empty' => '-- Selecciona la materia prima --', 'style' => 'width: 300px;'));
?>
		<?php 
echo $form->error($model, 'RawID');
?>
	</div>
	
	<div style="clear:both;"></div>

	<div class="row" style="float:left;">
		<?php 
echo $form->labelEx($model, 'Document');
?>
		<?php 
echo $form->textField($model, 'Document', array('size' => 20, 'maxlength' => 50));
?>
Пример #11
0
 private function checkToken()
 {
     $row = Raw::ApiAuth()->where(['token', '=', $this->token])->first(true);
     if ($row) {
         $expiration = $row->expiration;
         if (time() <= $expiration) {
             $row->setExpiration(time() + 3600)->save();
             return true;
         }
     }
     Api::forbidden();
 }
Пример #12
0
 /**
  * @covers Xoops\Form\Raw::__construct
  * @covers Xoops\Form\Raw::render
  */
 public function test__construct()
 {
     $oldWay = new Raw('myvalue');
     $newWay = new Raw(['value' => 'myvalue']);
     $this->assertEquals($oldWay->render(), $newWay->render());
 }
Пример #13
0
 /**
  * @covers Xoops\Form\Raw::render
  */
 public function testRender()
 {
     $value = $this->object->render();
     $this->assertTrue(is_string($value));
     $this->assertSame('value', $value);
 }
Пример #14
0
 protected function raw(Raw $raw)
 {
     $this->addBindings($raw->getBindings());
     return $raw->getQuery();
 }
Пример #15
0
 /**
  * @dataProvider provideTestFilter
  */
 public function testFilter($raw)
 {
     $int = new Raw(array());
     $this->assertEquals($raw, $int->filter($raw));
     $this->assertEquals(true, $int->validate($raw));
 }
Пример #16
0
 /**
  * @test
  */
 public function testCommandGeneration()
 {
     $cmd_str = 'execute raw command';
     $cmd = new Raw($cmd_str);
     $this->assertEquals($cmd_str, $cmd->getCommand());
 }
Пример #17
0
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = Raw::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Пример #18
0
				FICHA DE PROVEEDORES
			</td>
		</tr>
		<tr>
			<td style="border: 1px solid #555;"><b>Proveedor</b></td>
			<td style="border: 1px solid #555;"><b>Direccion</b></td>
			<td style="border: 1px solid #555;"><b>Telefono</b></td>
			<td style="border: 1px solid #555;"><b>Persona contacto</b></td>
			<td style="border: 1px solid #555;"><b>NRGSEAA</b></td>
			<td style="border: 1px solid #555;"><b>Materia primas</b></td>
		</tr>
		
		<?php 
$modelProviders = Provider::model()->findAllByAttributes(array("UserID" => Yii::app()->user->ID));
foreach ($modelProviders as $Provider) {
    $modelRaws = Raw::model()->findAllByAttributes(array("ProviderID" => $Provider->ID, "UserID" => Yii::app()->user->ID));
    $finalRaws = "";
    foreach ($modelRaws as $Raw) {
        $finalRaws .= $Raw->Name . ", ";
    }
    ?>
				<tr>
					<td><?php 
    echo $Provider->Name;
    ?>
</td>
					<td><?php 
    echo $Provider->Address;
    ?>
</td>
					<td><?php 
Пример #19
0
 public function render()
 {
     $this->header('Location', $this->location);
     return parent::render($this->location);
 }