static function colorData($value) { $control = new MLabel($value); $date = Manager::date($value); $color = $date->compare('>', '01/10/2011') ? 'blue' : 'red'; $control->addStyle('color', $color); return $control; }
public function dates() { // Create a MDate object $date = Manager::date('01/07/2011'); // Show formatted $this->data->baseDate = "Data base para o exemplo: " . $date->format(); // Clonning $newDate = $date->copy(); $this->data->cloneDate = "Clone da data base: " . $newDate->format(); // Adding interval $date->add('P2D'); $this->data->addDate = "Adicionando 2 dias: " . $date->format(); // Subtracting interval $date->sub('P5D'); $this->data->subDate = "Subtraindo 5 dias: " . $date->format(); // Difference between dates $diff = $date->diff('23/07/2011'); $this->data->diffDate1 = "Diferença entre " . $date->format() . ' e 23/07/2011 = ' . $diff . ' dias'; $diff = $date->diff('13/10/2011', '%m meses e %d dias'); $this->data->diffDate2 = "Diferença entre " . $date->format() . ' e 13/10/2011 = ' . $diff; // Comparing dates $date = Manager::date('01/07/2011'); $compare = $date->compare('>', '15/06/2011'); $this->data->compDate1 = $date . ' > 15/06/2011 ? ' . ($compare ? 'SIM' : 'NÃO'); $compare = $date->compare('=', '01/07/2011'); $this->data->compDate2 = $date . ' = 01/07/2011 ? ' . ($compare ? 'SIM' : 'NÃO'); $compare = $date->compare('<', '01/07/2011'); $this->data->compDate3 = $date . ' < 01/07/2011 ? ' . ($compare ? 'SIM' : 'NÃO'); // generic get $date = Manager::date('01/07/2011'); $this->data->getDay = "getDay = " . $date->getDay(); $this->data->getMonth = "getMonth = " . $date->getMonth(); $this->data->getYear = "getYear = " . $date->getYear(); $this->data->getDayNick = "getDayNick = " . $date->getDayNick(); $this->data->getMonthNick = "getMonthNick = " . $date->getMonthNick(); $this->data->getYear = "getYear = " . $date->getYear('y'); $this->data->getDayName = "getDayName = " . $date->getDayName(); $this->data->getMonthName = "getMonthName = " . $date->getMonthName(); $this->data->getFullName = "getFullName = " . $date->getFullName(); $this->data->getFullNameTrue = "getFullName(true) = " . $date->getFullName(true); // Invert date $this->data->invertDate = "Data invertida = " . $date->invert(); // Using DatePeriod $period = $date->getPeriod('15/07/2011', 'P1D', '23/07/2011'); $this->data->periodoTitulo1 = "Períodos de 1 dia entre 15/07/2011 e 23/07/2011:"; foreach ($period as $dt) { $this->data->periodo1 .= \Manager::date($dt) . ' - '; } $period = $date->getPeriod('01/01/2011', 'P14D', '23/07/2011'); $this->data->periodoTitulo2 = "Períodos de 14 dias entre 01/01/2011 e 23/07/2011:"; foreach ($period as $dt) { $this->data->periodo2 .= \Manager::date($dt) . ' - '; } $this->render(); }
public function formTextField() { $this->data->email = '*****@*****.**'; $this->data->nomeValidator = false; $this->data->currency = Manager::currency(1234.56); $this->data->dataNascimento = Manager::date(Manager::getSysDate()); $this->data->timestamp = Manager::timestamp(Manager::getSysTime()); $this->render(); }
/** * Query with automatic join and expressions. * @return <type> */ public function criteriaMethod01() { $criteria = $this->getCriteria()->select("*, (pessoa.nome || ' ' || pessoa.email) as nome")->where('pessoa.idPessoa = 1')->and_("pessoa.dataNascimento", ">", \Manager::date('01/01/1976'))->orderBy('pessoa.nome'); return $criteria; }