Ejemplo n.º 1
0
function select_time($datetime = Null, $options = array())
{
    if ($datetime == Null) {
        $datetime = SDateTime::today();
    }
    $order = isset($options['order']) ? $options['order'] : array('hour', 'minute', 'second');
    $html = '';
    foreach ($order as $param) {
        $html .= call_user_func('select_' . $param, $datetime, $options);
    }
    return $html;
    //return select_hour($datetime, $options).select_minute($datetime, $options).select_second($datetime, $options);
}
Ejemplo n.º 2
0
 public function testMigratorGoingDownDueToVersionTarget()
 {
     SMigrator::up(dirname(__FILE__) . '/fixtures/migrate', 1);
     SMigrator::migrate(dirname(__FILE__) . '/fixtures/migrate', 0);
     $this->assertFalse(in_array('last_name', array_keys(SActiveRecord::connection()->columns('people'))));
     $this->assertFalse(SActiveStore::tableExists('reminders'));
     SMigrator::migrate(dirname(__FILE__) . '/fixtures/migrate');
     $this->assertEqual(2, SMigrator::currentVersion());
     SActiveStore::resetAttributeInformation('people');
     $this->assertTrue(in_array('last_name', array_keys(SActiveRecord::connection()->columns('people'))));
     $r = new Reminder(array('content' => 'hello world', 'remind_at' => SDateTime::today()));
     $r->save();
     $this->assertEqual('hello world', SActiveStore::findFirst('reminder')->content);
 }
 private function logProcessing()
 {
     $log = 'Processing ' . $this->controllerClassName() . '::' . $this->actionName() . '() for ' . $this->request->remoteIp() . ' at ' . SDateTime::today()->__toString() . ' [' . $this->request->method() . ']';
     if (($sessId = $this->session->sessionId()) != '') {
         $log .= "\n    Session ID: " . $sessId;
     }
     $log .= "\n    Parameters: " . serialize($this->params) . "\n";
     $this->logger->info($log);
 }
Ejemplo n.º 4
0
 protected function saveWithTimestamps()
 {
     $t = SDateTime::today();
     if ($this->isNewRecord()) {
         if ($this->attrExists('created_on')) {
             $this->values['created_on'] = $t->__toString();
         }
     }
     if ($this->attrExists('updated_on')) {
         $this->values['updated_on'] = $t->__toString();
     }
 }