本文整理汇总了PHP中TCriteria::setProperties方法的典型用法代码示例。如果您正苦于以下问题:PHP TCriteria::setProperties方法的具体用法?PHP TCriteria::setProperties怎么用?PHP TCriteria::setProperties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TCriteria
的用法示例。
在下文中一共展示了TCriteria::setProperties方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onReload
/**
* method onReload()
* Load the datagrid with the database objects
*/
function onReload($param = NULL)
{
try {
// open a transaction with database 'samples'
TTransaction::open('samples');
// creates a repository for Product
$repository = new TRepository('Product');
$limit = 10;
// creates a criteria
$criteria = new TCriteria();
$criteria->setProperties($param);
// order, offset
$criteria->setProperty('limit', $limit);
// update the save action parameters to pass
// offset, limit, page and other info to the save action
$this->saveAction->setParameters($param);
// important!
// load the objects according to criteria
$objects = $repository->load($criteria);
$this->datagrid->clear();
if ($objects) {
// iterate the collection of active records
foreach ($objects as $object) {
$object->sale_price_edit = new TEntry('sale_price_' . $object->id);
$object->sale_price_edit->setNumericMask(1, '.', ',');
$object->sale_price_edit->setSize(120);
$object->sale_price_edit->setValue($object->sale_price);
$this->form->addField($object->sale_price_edit);
// important!
// add the object inside the datagrid
$this->datagrid->addItem($object);
}
}
// reset the criteria for record count
$criteria->resetProperties();
$count = $repository->count($criteria);
$this->pageNavigation->setCount($count);
// count of records
$this->pageNavigation->setProperties($param);
// order, page
$this->pageNavigation->setLimit($limit);
// limit
// close the transaction
TTransaction::close();
$this->loaded = true;
} catch (Exception $e) {
// shows the exception error message
new TMessage('error', '<b>Error</b> ' . $e->getMessage());
// undo all pending operations
TTransaction::rollback();
}
}
示例2: onReload
/**
* method onReload()
* Load the datagrid with the database objects
*/
function onReload($param = NULL)
{
try {
// open a transaction with database 'atividade'
TTransaction::open('atividade');
// creates a repository for StatusTicket
$repository = new TRepository('StatusTicket');
$limit = 10;
// creates a criteria
$criteria = new TCriteria();
// default order
if (empty($param['order'])) {
$param['order'] = 'id';
$param['direction'] = 'asc';
}
$criteria->setProperties($param);
// order, offset
$criteria->setProperty('limit', $limit);
if (TSession::getValue('StatusTicket_filter')) {
// add the filter stored in the session to the criteria
$criteria->add(TSession::getValue('StatusTicket_filter'));
}
// load the objects according to criteria
$objects = $repository->load($criteria, FALSE);
$this->datagrid->clear();
if ($objects) {
// iterate the collection of active records
foreach ($objects as $object) {
// add the object inside the datagrid
$this->datagrid->addItem($object);
}
}
// reset the criteria for record count
$criteria->resetProperties();
$count = $repository->count($criteria);
$this->pageNavigation->setCount($count);
// count of records
$this->pageNavigation->setProperties($param);
// order, page
$this->pageNavigation->setLimit($limit);
// limit
// close the transaction
TTransaction::close();
$this->loaded = true;
} catch (Exception $e) {
new TMessage('error', '<b>Error</b> ' . $e->getMessage());
// shows the exception error message
TTransaction::rollback();
// undo all pending operations
}
}
示例3: onReload
/**
* method onReload()
* Load the datagrid with the database objects
*/
function onReload($param = NULL)
{
try {
// open a transaction with database 'samples'
TTransaction::open('samples');
// creates a repository for Customer
$repository = new TRepository('Customer');
$limit = 10;
// creates a criteria
$criteria = new TCriteria();
$criteria->setProperties($param);
// order, offset
$criteria->setProperty('limit', $limit);
// load the objects according to criteria
$objects = $repository->load($criteria);
$this->datagrid->clear();
if ($objects) {
// iterate the collection of active records
foreach ($objects as $object) {
// add the object inside the datagrid
$this->datagrid->addItem($object);
}
}
// reset the criteria for record count
$criteria->resetProperties();
$count = $repository->count($criteria);
$this->pageNavigation->setCount($count);
// count of records
$this->pageNavigation->setProperties($param);
// order, page
$this->pageNavigation->setLimit($limit);
// limit
// close the transaction
TTransaction::close();
$this->loaded = true;
} catch (Exception $e) {
// shows the exception error message
new TMessage('error', '<b>Error</b> ' . $e->getMessage());
// undo all pending operations
TTransaction::rollback();
}
}
示例4: onReload
/**
* method onReload()
* Load the datagrid with the database objects
*/
function onReload($param = NULL)
{
try {
// open a transaction with database 'atividade'
TTransaction::open('atividade');
// creates a repository for RequisitoDesenvolvimento
$repository = new TRepository('RequisitoDesenvolvimento');
$limit = 10;
// creates a criteria
$criteria = new TCriteria();
$newparam = $param;
// define new parameters
if (isset($newparam['order']) and $newparam['order'] == 'ticket->titulo') {
$newparam['order'] = '(select titulo from ticket where ticket_id = id)';
}
// default order
if (empty($newparam['order'])) {
$newparam['order'] = 'id';
$newparam['direction'] = 'desc';
}
$criteria->setProperties($newparam);
// order, offset
$criteria->setProperty('limit', $limit);
if (TSession::getValue('RequisitoDesenvolvimentoList_filter_id')) {
$criteria->add(TSession::getValue('RequisitoDesenvolvimentoList_filter_id'));
// add the session filter
}
if (TSession::getValue('RequisitoDesenvolvimentoList_filter_titulo')) {
$criteria->add(TSession::getValue('RequisitoDesenvolvimentoList_filter_titulo'));
// add the session filter
}
if (TSession::getValue('RequisitoDesenvolvimentoList_filter_data_cadastro')) {
$criteria->add(TSession::getValue('RequisitoDesenvolvimentoList_filter_data_cadastro'));
// add the session filter
}
// load the objects according to criteria
$objects = $repository->load($criteria, FALSE);
$this->datagrid->clear();
if ($objects) {
// iterate the collection of active records
foreach ($objects as $object) {
// add the object inside the datagrid
$this->datagrid->addItem($object);
}
}
// reset the criteria for record count
$criteria->resetProperties();
$count = $repository->count($criteria);
$this->pageNavigation->setCount($count);
// count of records
$this->pageNavigation->setProperties($param);
// order, page
$this->pageNavigation->setLimit($limit);
// limit
// close the transaction
TTransaction::close();
$this->loaded = true;
} catch (Exception $e) {
// shows the exception error message
new TMessage('error', '<b>Error</b> ' . $e->getMessage());
// undo all pending operations
TTransaction::rollback();
}
}
示例5: onReload
/**
* method onReload()
* Load the datagrid with the database objects
*/
function onReload($param = NULL)
{
try {
// open a transaction with database 'saciq'
TTransaction::open('saciq');
// creates a repository for Fornecedor
$repository = new TRepository('Fornecedor');
$limit = 10;
// creates a criteria
$criteria = new TCriteria();
// default order
if (empty($param['order'])) {
$param['order'] = 'id';
$param['direction'] = 'asc';
}
$criteria->setProperties($param);
// order, offset
$criteria->setProperty('limit', $limit);
if (TSession::getValue('FornecedorList_filter_nome')) {
$criteria->add(TSession::getValue('FornecedorList_filter_nome'));
// add the session filter
}
if (TSession::getValue('FornecedorList_filter_cnpj')) {
$criteria->add(TSession::getValue('FornecedorList_filter_cnpj'));
// add the session filter
}
// load the objects according to criteria
$objects = $repository->load($criteria, FALSE);
$this->datagrid->clear();
if ($objects) {
// iterate the collection of active records
foreach ($objects as $object) {
// add the object inside the datagrid
$this->datagrid->addItem($object);
}
}
// reset the criteria for record count
$criteria->resetProperties();
$count = $repository->count($criteria);
$this->pageNavigation->setCount($count);
// count of records
$this->pageNavigation->setProperties($param);
// order, page
$this->pageNavigation->setLimit($limit);
// limit
// close the transaction
TTransaction::close();
$this->loaded = true;
} catch (Exception $e) {
if ($e->getCode() == 23000) {
new TMessage('error', '<b>Registro duplicado</b><br>Verifique os campos inseridos e tente novamente');
} else {
if ($e->getCode() == 0) {
new TMessage('error', '<b>Error</b> <br>' . $e->getMessage());
} else {
new TMessage('error', '<b>Error Desconhecido</b> <br>Código: ' . $e->getCode());
}
}
// desfazer todas as operacoes pendentes
TTransaction::rollback();
}
}
示例6: onReload
/**
* method onReload()
* Load the datagrid with the database objects
*/
function onReload($param = NULL)
{
try {
// open a transaction with database 'changeman'
TTransaction::open('changeman');
// creates a repository for Issue
$repository = new TRepository('Issue');
if (!isset($param['order']) or $param['order'] == 'id') {
$param['order'] = 'id';
$param['direction'] = 'desc';
}
$limit = 100;
// creates a criteria
$criteria = new TCriteria();
$criteria->setProperties($param);
// order, offset
$criteria->setProperty('limit', $limit);
if (TSession::getValue('Issue_filter')) {
foreach (TSession::getValue('Issue_filter') as $filter) {
// add the filter stored in the session to the criteria
$criteria->add($filter);
}
}
$member = Member::newFromLogin(TSession::getValue('login'));
if ($member->role_mnemonic == 'CUSTOMER') {
$criteria->add(new TFilter('id_user', '=', $member->id));
}
// load the objects according to criteria
$objects = $repository->load($criteria);
$this->datagrid->clear();
if ($objects) {
// iterate the collection of active records
foreach ($objects as $object) {
// add the object inside the datagrid
$this->datagrid->addItem($object);
}
}
// reset the criteria for record count
$criteria->resetProperties();
$count = $repository->count($criteria);
$this->pageNavigation->setCount($count);
// count of records
$this->pageNavigation->setProperties($param);
// order, page
$this->pageNavigation->setLimit($limit);
// limit
// close the transaction
TTransaction::close();
$this->loaded = true;
} catch (Exception $e) {
// shows the exception error message
new TMessage('error', '<b>Error</b> ' . $e->getMessage());
// undo all pending operations
TTransaction::rollback();
}
}
示例7: onReload
/**
* Load the datagrid with the active record objects
*/
public function onReload($param = NULL)
{
try {
$model = TSession::getValue('standard_seek_model');
$database = TSession::getValue('standard_seek_database');
// begins the transaction with database
TTransaction::open($database);
// creates a repository for the model
$repository = new TRepository($model);
$limit = 10;
// creates a criteria
$criteria = new TCriteria();
$criteria->setProperties($param);
// order, offset
$criteria->setProperty('limit', $limit);
if (TSession::getValue('tstandardseek_filter')) {
// add the filter to the criteria
$criteria->add(TSession::getValue('tstandardseek_filter'));
}
// load all objects according with the criteria
$clientes = $repository->load($criteria);
$this->datagrid->clear();
if ($clientes) {
$display_field = TSession::getValue('standard_seek_display_field');
foreach ($clientes as $cliente) {
$item = $cliente;
$item->display_field = $cliente->{$display_field};
// add the object into the datagrid
$this->datagrid->addItem($item);
}
}
// clear the crieteria to count the records
$criteria->resetProperties();
$count = $repository->count($criteria);
$this->pageNavigation->setCount($count);
// count of records
$this->pageNavigation->setProperties($param);
// order, page
$this->pageNavigation->setLimit($limit);
// limit
// closes the transaction
TTransaction::close();
$this->loaded = true;
} catch (Exception $e) {
// shows the exception genearated message
new TMessage('error', '<b>Erro</b> ' . $e->getMessage());
// rollback all the database operations
TTransaction::rollback();
}
}
示例8: onReload
/**
* method onReload()
* Load the datagrid with the database objects
*/
function onReload($param = NULL)
{
try {
// open a transaction with database 'changeman'
TTransaction::open('changeman');
$member = Member::newFromLogin(TSession::getValue('login'));
// creates a repository for Release
$repository = new TRepository('Release');
$limit = 10;
// creates a criteria
$criteria = new TCriteria();
$criteria->setProperties($param);
// order, offset
$criteria->setProperty('limit', $limit);
if (TSession::getValue('Release_filter')) {
// add the filter stored in the session to the criteria
$criteria->add(TSession::getValue('Release_filter'));
}
// customer may only view its projects
if ($member->role_mnemonic == 'CUSTOMER') {
$member_projects_ids = array_keys($member->getProjectsList());
$criteria->add(new TFilter('id_project', 'IN', $member_projects_ids));
}
// load the objects according to criteria
$objects = $repository->load($criteria);
$this->datagrid->clear();
if ($objects) {
// iterate the collection of active records
foreach ($objects as $object) {
// add the object inside the datagrid
$this->datagrid->addItem($object);
}
}
// reset the criteria for record count
$criteria->resetProperties();
$count = $repository->count($criteria);
$this->pageNavigation->setCount($count);
// count of records
$this->pageNavigation->setProperties($param);
// order, page
$this->pageNavigation->setLimit($limit);
// limit
// close the transaction
TTransaction::close();
$this->loaded = true;
} catch (Exception $e) {
// shows the exception error message
new TMessage('error', '<b>Error</b> ' . $e->getMessage());
// undo all pending operations
TTransaction::rollback();
}
}
示例9: onReload
/**
* Load the datagrid with data
*/
public function onReload($param = NULL)
{
try {
// open a transaction with database 'sample'
TTransaction::open('sample');
// creates a repository for telefone
$repository = new TRepository('telefone');
$limit = 10;
// creates a criteria
$criteria = new TCriteria();
$filter = new TFilter('clientes_id', '=', $param['key']);
$criteria->add($filter);
// default order
if (empty($param['order'])) {
$param['order'] = 'id';
$param['direction'] = 'asc';
}
$criteria->setProperties($param);
// order, offset
$criteria->setProperty('limit', $limit);
// load the objects according to criteria
$objects = $repository->load($criteria, FALSE);
if (is_callable($this->transformCallback)) {
call_user_func($this->transformCallback, $objects, $param);
}
$this->datagrid->clear();
if ($objects) {
// iterate the collection of active records
foreach ($objects as $object) {
// add the object inside the datagrid
$this->datagrid->addItem($object);
}
}
// reset the criteria for record count
$criteria->resetProperties();
$count = $repository->count($criteria);
$this->pageNavigation->setCount($count);
// count of records
$this->pageNavigation->setProperties($param);
// order, page
$this->pageNavigation->setLimit($limit);
// limit
// close the transaction
TTransaction::close();
$this->loaded = true;
} catch (Exception $e) {
// shows the exception error message
new TMessage('error', $e->getMessage());
// undo all pending operations
TTransaction::rollback();
}
}
示例10: onEdit
/**
* method onEdit()
* Executed whenever the user clicks at the edit button da datagrid
*/
function onEdit($param)
{
$string = new StringsUtil();
try {
TTransaction::open('atividade');
// open a transaction
$logado = Pessoa::retornaUsuario();
if (isset($param['key'])) {
$key = $param['key'];
// get the parameter $key
$atividade = new Atividade($key);
$criteria = new TCriteria();
$newparam['order'] = 'id';
$newparam['direction'] = 'asc';
$criteria->setProperties($newparam);
// order, offset
$this->onComboTicket($criteria);
$this->onSetarValoresCombo($atividade->ticket_id);
// criar metodo de preenchimento de horas
$HoraEntrada = new DateTime($atividade->hora_inicio);
$HoraSaida = new DateTime($atividade->hora_fim);
$diffHoras = $HoraSaida->diff($HoraEntrada)->format('%H:%I:%S');
$horas = explode(':', $atividade->hora_fim);
$atividade->qtde_horas = $horas[0];
$atividade->qtde_minutos = $horas[1];
TCombo::disableField('form_Atividade', 'qtde_horas');
TCombo::disableField('form_Atividade', 'qtde_minutos');
$atividade->tempo_atividade = $diffHoras;
$ultimaAtividade = Atividade::retornaUltimaAtividade($atividade->colaborador_id);
if (!$ultimaAtividade) {
$action = new TAction(array('AtividadeList', 'onReload'));
new TMessage('info', 'Nenhuma atividade cadastrada!', $action);
// success message
}
if ($key != $ultimaAtividade) {
TButton::disableField('form_Atividade', 'delete');
}
$atividade->data_atividade ? $atividade->data_atividade = $string->formatDateBR($atividade->data_atividade) : null;
$colaborador = new Pessoa($atividade->colaborador_id);
$atividade->colaborador_nome = $colaborador->pessoa_nome;
if ($logado->pessoa_codigo != $atividade->colaborador_id) {
TButton::disableField('form_Atividade', 'save');
TButton::disableField('form_Atividade', 'delete');
}
TButton::disableField('form_Atividade', 'atividade');
$this->form->setData($atividade);
// fill the form
} else {
$object = new Atividade();
$object->colaborador_id = $logado->pessoa_codigo;
$object->colaborador_nome = $logado->pessoa_nome;
$this->form->setData($object);
}
TTransaction::close();
// close the transaction
} catch (Exception $e) {
new TMessage('error', '<b>Error</b> ' . $e->getMessage());
// shows the exception error message
TTransaction::rollback();
// undo all pending operations
}
}
示例11: onReload
/**
* method onReload()
* Load the datagrid with the database objects
*/
function onReload($param = NULL)
{
try {
// open a transaction with database 'permission'
TTransaction::open('permission');
if (!isset($param['order'])) {
$param['order'] = 'id';
$param['direction'] = 'asc';
}
// creates a repository for System_group
$repository = new TRepository('SystemEmployees');
$limit = 10;
// creates a criteria
$criteria = new TCriteria();
$criteria->setProperties($param);
// order, offset
$criteria->setProperty('limit', $limit);
if (TSession::getValue('s_id_filter')) {
// add the filter stored in the session to the criteria
$criteria->add(TSession::getValue('s_id_filter'));
}
if (TSession::getValue('s_dni_filter')) {
// add the filter stored in the session to the criteria
$criteria->add(TSession::getValue('s_dni_filter'));
}
if (TSession::getValue('s_name_filter')) {
// add the filter stored in the session to the criteria
$criteria->add(TSession::getValue('s_name_filter'));
}
if (TSession::getValue('s_address_filter')) {
// add the filter stored in the session to the criteria
$criteria->add(TSession::getValue('s_address_filter'));
}
if (TSession::getValue('s_email_filter')) {
// add the filter stored in the session to the criteria
$criteria->add(TSession::getValue('s_email_filter'));
}
if (TSession::getValue('s_phone_filter')) {
// add the filter stored in the session to the criteria
$criteria->add(TSession::getValue('s_phone_filter'));
}
// load the objects according to criteria
$objects = $repository->load($criteria);
$this->datagrid->clear();
if ($objects) {
// iterate the collection of active records
foreach ($objects as $object) {
// add the object inside the datagrid
$this->datagrid->addItem($object);
}
}
// reset the criteria for record count
$criteria->resetProperties();
$count = $repository->count($criteria);
$this->pageNavigation->setCount($count);
// count of records
$this->pageNavigation->setProperties($param);
// order, page
$this->pageNavigation->setLimit($limit);
// limit
// close the transaction
TTransaction::close();
$this->loaded = true;
} catch (Exception $e) {
// shows the exception error message
new TMessage('error', '<b>Error</b> ' . $e->getMessage());
// undo all pending operations
TTransaction::rollback();
}
}
示例12: onReload
/**
* method onReload()
* Load the datagrid with the database objects
*/
function onReload($param = NULL)
{
try {
// open a transaction with database 'samples'
TTransaction::open('samples');
// creates a repository for Product
$repository = new TRepository('Product');
$limit = 10;
// creates a criteria
$criteria = new TCriteria();
$criteria->setProperties($param);
// order, offset
$criteria->setProperty('limit', $limit);
$criteria->setProperty('order', 'description');
if (TSession::getValue('product_filter1')) {
// add the filter stored in the session to the criteria
$criteria->add(TSession::getValue('product_filter1'));
}
// load the objects according to criteria
$products = $repository->load($criteria);
$this->datagrid->clear();
if ($products) {
foreach ($products as $product) {
// add the object inside the datagrid
$this->datagrid->addItem($product);
}
}
$this->cartgrid->clear();
$cart_objects = TSession::getValue('cart_objects');
$total = 0;
if ($cart_objects) {
foreach ($cart_objects as $object) {
$this->cartgrid->addItem($object);
$total += $object->sale_price;
}
}
$this->total->setValue(number_format($total));
// reset the criteria for record count
$criteria->resetProperties();
$count = $repository->count($criteria);
$this->pageNavigation->setCount($count);
// count of records
$this->pageNavigation->setProperties($param);
// order, page
$this->pageNavigation->setLimit($limit);
// limit
// close the transaction
TTransaction::close();
$this->loaded = true;
} catch (Exception $e) {
// shows the exception error message
new TMessage('error', '<b>Error</b> ' . $e->getMessage());
// undo all pending operations
TTransaction::rollback();
}
}
示例13: onReload
/**
* method onReload()
* Load the datagrid with the database objects
*/
function onReload($param = NULL)
{
try {
// open a transaction with database 'atividade'
TTransaction::open('atividade');
// creates a repository for Atividade
$repository = new TRepository('Atividade');
$limit = 15;
// creates a criteria
$criteria = new TCriteria();
$criHoras = new TCriteria();
$criteria2 = new TCriteria();
$criHoras2 = new TCriteria();
$calculaHoras = null;
$pesquisaNormal = null;
$newparam = $param;
// define new parameters
if (isset($newparam['order']) and $newparam['order'] == 'ticket->titulo') {
$newparam['order'] = '(select titulo from ticket where ticket_id = id)';
}
if (isset($newparam['order']) and $newparam['order'] == 'pessoa->pessoa_nome') {
$newparam['order'] = '(select pessoa_nome from tbz_pessoas where pessoa_codigo = colaborador_id)';
}
if (isset($newparam['order']) and $newparam['order'] == 'tipo_atividade->nome') {
$newparam['order'] = '(select nome from tipo_atividade where tipo_atividade_id = id)';
}
if (isset($newparam['order']) and $newparam['order'] == 'sistema->nome') {
$newparam['order'] = '(select nome from sistema where sistema_id = id)';
}
// default order
if (empty($newparam['order'])) {
$newparam['order'] = 'data_atividade desc, id ';
$newparam['direction'] = 'desc';
}
$criteria->setProperties($newparam);
// order, offset
$criteria->setProperty('limit', $limit);
if (TSession::getValue('AtividadeList_filter_id')) {
$criteria->add(TSession::getValue('AtividadeList_filter_id'));
// add the session filter
$criHoras->add(TSession::getValue('AtividadeList_filter_id'));
// add the session filter
$calculaHoras = true;
$pesquisaNormal = true;
}
if (TSession::getValue('AtividadeList_filter_data_atividade_inicial')) {
$criteria->add(TSession::getValue('AtividadeList_filter_data_atividade_inicial'));
// add the session filter
$criHoras->add(TSession::getValue('AtividadeList_filter_data_atividade_inicial'));
// add the session filter
$calculaHoras = true;
$pesquisaNormal = true;
}
if (TSession::getValue('AtividadeList_filter_data_atividade_final')) {
$criteria->add(TSession::getValue('AtividadeList_filter_data_atividade_final'));
// add the session filter
$criHoras->add(TSession::getValue('AtividadeList_filter_data_atividade_final'));
// add the session filter
$calculaHoras = true;
$pesquisaNormal = true;
}
if (TSession::getValue('AtividadeList_filter_solicitante_id')) {
$criteria->add(TSession::getValue('AtividadeList_filter_solicitante_id'));
// add the session filter
$criHoras->add(TSession::getValue('AtividadeList_filter_solicitante_id'));
// add the session filter
$calculaHoras = true;
$pesquisaNormal = true;
}
if (TSession::getValue('AtividadeList_filter_colaborador_id')) {
$criteria->add(TSession::getValue('AtividadeList_filter_colaborador_id'));
// add the session filter
$criHoras->add(TSession::getValue('AtividadeList_filter_colaborador_id'));
// add the session filter
$calculaHoras = true;
$pesquisaNormal = true;
}
if (TSession::getValue('AtividadeList_filter_tipo_atividade_id')) {
$criteria->add(TSession::getValue('AtividadeList_filter_tipo_atividade_id'));
// add the session filter
$criHoras->add(TSession::getValue('AtividadeList_filter_tipo_atividade_id'));
// add the session filter
$calculaHoras = true;
$pesquisaNormal = true;
}
if (TSession::getValue('AtividadeList_filter_ticket_id')) {
$criteria->add(TSession::getValue('AtividadeList_filter_ticket_id'));
// add the session filter
$criHoras->add(TSession::getValue('AtividadeList_filter_ticket_id'));
// add the session filter
$calculaHoras = true;
$pesquisaNormal = true;
}
if (TSession::getValue('AtividadeList_filter_pesquisa_master')) {
try {
TTransaction::open('atividade');
//.........这里部分代码省略.........
示例14: onReload
function onReload($param = NULL)
{
try {
TTransaction::open('liger');
if (!isset($param['order'])) {
$param['order'] = 'imovel_id';
$param['direction'] = 'asc';
}
$repository = new TRepository('Imovel');
$limit = 10;
$criteria = new TCriteria();
$criteria->setProperties($param);
// order, offset
$criteria->setProperty('limit', $limit);
if (TSession::getValue('s_id_filter')) {
$criteria->add(TSession::getValue('s_id_filter'));
}
if (TSession::getValue('s_name_filter')) {
$criteria->add(TSession::getValue('s_name_filter'));
}
$objects = $repository->load($criteria);
$this->datagrid->clear();
if ($objects) {
foreach ($objects as $object) {
$this->datagrid->addItem($object);
}
}
$criteria->resetProperties();
$count = $repository->count($criteria);
$this->pageNavigation->setCount($count);
// count of records
$this->pageNavigation->setProperties($param);
// order, page
$this->pageNavigation->setLimit($limit);
// limit
// close the transaction
TTransaction::close();
$this->loaded = true;
} catch (Exception $e) {
// shows the exception error message
new TMessage('error', '<b>Error</b> ' . $e->getMessage());
// undo all pending operations
TTransaction::rollback();
}
}
示例15: StringsUtil
/**
* Class constructor
* Creates the page and the registration form
*/
function __construct()
{
parent::__construct();
$this->string = new StringsUtil();
// creates the form
$this->form = new TForm('form_Atividade_Cliente');
$this->form->class = 'tform';
// CSS class
$this->form->style = 'width: 500px';
// creates the table container
$table = new TTable();
$table->width = '100%';
// add the table inside the form
$this->form->add($table);
// define the form title
$row = $table->addRow();
$row->class = 'tformtitle';
$cell = $row->addCell(new TLabel('Indicador por Periodo'));
$cell->colspan = 2;
// create the form fields
// cria array para popular as combos
TTransaction::open('atividade');
$criteria = new TCriteria();
$criteria->add(new TFilter("origem", "=", 1));
$criteria->add(new TFilter("codigo_cadastro_origem", "=", 100));
$criteria->add(new TFilter("ativo", "=", 1));
$newparam['order'] = 'pessoa_nome';
$newparam['direction'] = 'asc';
$criteria->setProperties($newparam);
// order, offset
$repo = new TRepository('Pessoa');
$pessoas = $repo->load($criteria);
$arrayPessoas[-1] = 'TODOS COLABORADORES';
foreach ($pessoas as $pessoa) {
$arrayPessoas[$pessoa->pessoa_codigo] = $pessoa->pessoa_nome;
}
$criteria = new TCriteria();
$criteria->add(new TFilter("enttipent", "=", "1"));
$newparam['order'] = 'entcodent';
$newparam['direction'] = 'asc';
$criteria->setProperties($newparam);
// order, offset
$repo = new TRepository('Entidade');
$clientes = $repo->load($criteria);
$arrayClientes[-1] = 'TODOS CLIENTES';
foreach ($clientes as $cliente) {
$arrayClientes[$cliente->entcodent] = str_pad($cliente->entcodent, 4, '0', STR_PAD_LEFT) . ' - ' . $cliente->entrazsoc;
}
$arrayClientes[999] = 'ECS 999';
TTransaction::close();
$colaborador_id = new TCombo('colaborador_id');
$colaborador_id->setDefaultOption(FALSE);
$colaborador_id->addItems($arrayPessoas);
$cliente_id = new TCombo('cliente_id');
$cliente_id->setDefaultOption(FALSE);
$cliente_id->addItems($arrayClientes);
$anos = array(2015 => '2015');
$mes_atividade_inicial = new TCombo('mes_atividade_inicial');
$mes_atividade_inicial->addItems($this->string->array_meses());
$mes_atividade_inicial->setDefaultOption(FALSE);
$mes_atividade_inicial->setValue(date('m'));
$ano_atividade_inicial = new TCombo('ano_atividade_inicial');
$ano_atividade_inicial->addItems($anos);
$ano_atividade_inicial->setDefaultOption(FALSE);
$mes_atividade_final = new TCombo('mes_atividade_final');
$mes_atividade_final->addItems($this->string->array_meses());
$mes_atividade_final->setDefaultOption(FALSE);
$mes_atividade_final->setValue(date('m'));
$ano_atividade_final = new TCombo('ano_atividade_final');
$ano_atividade_final->addItems($anos);
$ano_atividade_final->setDefaultOption(FALSE);
$output_type = new TRadioGroup('output_type');
// define the sizes
$colaborador_id->setSize(353);
$cliente_id->setSize(353);
$mes_atividade_inicial->setSize(250);
$ano_atividade_inicial->setSize(100);
$mes_atividade_final->setSize(250);
$ano_atividade_final->setSize(100);
$output_type->setSize(100);
// validations
$output_type->addValidation('Output', new TRequiredValidator());
// add one row for each form field
$table->addRowSet(new TLabel('Colaborador:'), $colaborador_id);
$table->addRowSet(new TLabel('Cliente:'), $cliente_id);
$table->addRowSet(new TLabel('Mês ano inicial:'), array($mes_atividade_inicial, $ano_atividade_inicial));
$table->addRowSet(new TLabel('Mês ano final:'), array($mes_atividade_final, $ano_atividade_final));
$table->addRowSet(new TLabel('Output:'), $output_type);
$this->form->setFields(array($colaborador_id, $cliente_id, $mes_atividade_inicial, $mes_atividade_final, $ano_atividade_inicial, $ano_atividade_final, $output_type));
$output_type->addItems(array('html' => 'HTML', 'pdf' => 'PDF', 'rtf' => 'RTF'));
$output_type->setValue('html');
$output_type->setLayout('horizontal');
$generate_button = TButton::create('generate', array($this, 'onGenerate'), _t('Generate'), 'fa:check-circle-o green');
$this->form->addField($generate_button);
// add a row for the form action
$table->addRowSet($generate_button, '')->class = 'tformaction';
//.........这里部分代码省略.........