예제 #1
0
 public function type($type = null)
 {
     if (DevValue::isNull($type)) {
         return $this->_type;
     }
     $this->_type = $type;
 }
예제 #2
0
 public function contents($data = null)
 {
     if (DevValue::isNull($data)) {
         return $this->_contents;
     }
     $this->_contents = $data;
     $this->perform(Event::CHANGE);
 }
예제 #3
0
 public function status($message = null)
 {
     if (DevValue::isNull($message)) {
         $message = end($this->_status);
         return $message;
     }
     $this->_status[] = $message;
     $this->perform(Event::MESSAGE);
 }
예제 #4
0
 public function contents($data = null)
 {
     if (DevValue::isNull($data)) {
         return $this->_rows->current() ? $this->_rows->current() : parent::contents();
     } elseif (is_array($data) && !DevArray::isAssoc($data)) {
         $this->_rows = new Group($data);
     } elseif (DevArray::isAssoc($data)) {
         parent::contents($data);
     }
     $this->perform(Event::CHANGE);
 }
예제 #5
0
 private function message($records = null)
 {
     $records = DevValue::isNull($records) ? $records : $this->config('max_logs');
     $message = array_slice($this->_data, -$records);
     $message = array_filter($message);
     // $output = implode("\n", $message)."\n";
     $output = '';
     foreach ($message as $time => $line) {
         $output .= "{$time} - {$line}\n";
     }
     return $output;
 }
예제 #6
0
 public static function difference($time1, $time2, $interval = null)
 {
     if (DevValue::isNull($interval)) {
         $interval = 'seconds';
     }
     $a = strtotime($time1);
     $b = strtotime($time2);
     $difference = $a > $b ? $a - $b : $b - $a;
     $div = 1;
     switch ($interval) {
         case 'years':
             $div *= 12;
         case 'months':
             $div *= 4;
         case 'weeks':
             $div *= 30;
         case 'days':
             $div *= 24;
         case 'hours':
             $div *= 60;
         case 'minutes':
             $div *= 60;
         default:
         case 'seconds':
             $div *= 1;
             break;
     }
     $output = $difference / $div;
     return $output;
 }
예제 #7
0
 public function outputXML($data = null)
 {
     header("Content-Type: XML");
     $xml = 'No XML';
     if (DevValue::isNull($data == '')) {
         $data = $this->_data;
     }
     $xml = $this->buildXML($data);
     echo $xml;
 }
예제 #8
0
 static function session($var, $value = null, $expire = null, $path = null, $secure = false)
 {
     if (DevValue::isNull($value)) {
         return isset($_SESSION[$var]) ? $_SESSION[$var] : null;
     }
     if (session_id() == '') {
         $domain = $path ? substr($path, 0, strpos($path, '/')) : HTTP::domain();
         $dir = $path ? substr($path, strpos($path, '/'), strlen($path)) : '/';
         $cookiedie = DevNumber::isValid($expire) ? time() + (int) $expire : (int) $expire;
         //expire in one hour
         $cookiesecure = (bool) $secure;
         session_set_cookie_params($cookiedie, $dir, $domain, $cookiesecure);
         session_start();
     }
     $status = ($_SESSION[$var] = $value) ? true : false;
     return $status;
 }
예제 #9
0
 public function component($name, $data = null, $configuration = null)
 {
     $object = null;
     if (DevValue::isNull($this->{$name})) {
         $object = new Programmable();
         $object->config($configuration);
         if (DevValue::isNotNull($data)) {
             $object->assign($data);
         }
     }
     return $this->field($name, $object);
 }
예제 #10
0
 static function open($action = '', $name = '', $method = '', $validate = true, $properties = '', $image_path = 'images/', $css_path = 'css/rte.css')
 {
     $output = '';
     $action = HTML::href($action);
     if (DevValue::isNull($method)) {
         $method = 'post';
     }
     $output .= '<form enctype="multipart/form-data" method="' . $method . '" ' . ($name != '' ? 'name="' . $name . '"' : '') . ' ' . ($action != '' ? 'action="' . $action . '"' : '') . ' ' . $properties . '>';
     $output .= "\r";
     /*
     $output .= '
     <script language="JavaScript" type="text/javascript">
     	<!--
     	function submitForm() {
     		//make sure hidden and iframe values are in sync before submitting form
     		//to sync only 1 rte, use updateRTE(rte)
     		//to sync all rtes, use updateRTEs
     		//updateRTE(\'rte1\');
     		updateRTEs();
     		
     		//change the following line to true to submit form
     		return true;
     	}
     	
     	//Usage: initRTE(imagesPath, includesPath, cssFile, genXHTML)
     	initRTE("' . $image_path . '", "", "", true);
     	//-->
     </script>
     <style type="text/css">
         @import url("'.$css_path.'");
         .rteImage {margin: 0px;}
     </style>
     ';
     */
     if ($validate) {
     }
     return $output;
 }
예제 #11
0
 public function contents($data = null)
 {
     if (DevValue::isNull($data)) {
         return $this->_contents;
     }
     $this->_contents = $data;
 }
예제 #12
0
 public function renderRecordSet($recordSet, $formatted = null)
 {
     $output = '';
     $count = 0;
     if (DevValue::isNull($formatted)) {
         $formatted = true;
     }
     foreach ($recordSet as $a) {
         $this->clear();
         $this->set($a, $formatted);
         $output .= $this->render();
         Util::parachute($count, $this->config('max_records'));
     }
     return $output;
 }
예제 #13
0
 public function testDoesntRecognizeValueAsNullStatically()
 {
     for ($i = 1; $i < 100; $i++) {
         $falseResult = DevValue::isNull($i);
         $trueResult = DevValue::isNotNull($i);
         $this->assertTrue($trueResult);
         $this->assertFalse($falseResult);
     }
 }
예제 #14
0
 public function database($database = null)
 {
     if (DevValue::isNull($database)) {
         return $this->config('database');
     }
     // $this->close();
     $this->config('database', $database);
     // $this->open();
     $this->_connection = $this->config('database') ? $this->_current->{$this->config('database')} : null;
 }
예제 #15
0
 public function database($database = null)
 {
     if (DevValue::isNull($database)) {
         return $this->config('database');
     }
     $this->config('database', $database);
     $db = $this->_connection;
     $db->select_db($this->config('database'));
 }
예제 #16
0
 private function distinctCase($table = null, $member)
 {
     $tables = $this->tables();
     $table = DevValue::isNull($table) ? $tables[0] : $table;
     $distinct = '';
     if (in_array($member, $this->_distinctions)) {
         $distinct = ' ' . $table . ".{$member} ";
     }
     return $distinct;
 }