/**
  * Custom search/filter
  *
  * @param Doctrine_query $q
  * @param string $str
  * @param string $root_tbl (optional)
  * @param string $root_alias (optional)
  */
 protected function apply_search($q, $str, $root_tbl = null, $root_alias = null)
 {
     $emls = "e.sem_email like '%{$str}%'";
     $srcs = "s.src_first_name like '{$str}%' OR s.src_last_name like '{$str}%'";
     $orgs = "o.org_name like '{$str}%' OR o.org_display_name like '{$str}%'";
     $q->addWhere("(({$emls}) OR ({$srcs}) OR ({$orgs}))");
 }
 public function setup()
 {
     parent::setup();
     unset($this['type'], $this['filesize'], $this['created_at'], $this['updated_at']);
     // add the i18n label stuff
     if ($this->getObject()->getTable()->isI18n()) {
         $cultures = sfConfig::get('app_lyMediaManager_i18n_cultures', array());
         if (isset($cultures[0])) {
             throw new sfException('Invalid i18n_cultures format in app.yml. Use the format:
     i18n_cultures:
       en:   English
       fr:   Français');
         }
         $this->embedI18n(array_keys($cultures));
         foreach ($cultures as $culture => $name) {
             $this->widgetSchema->setLabel($culture, $name);
         }
     }
     $this->widgetSchema['folder_id']->setOption('method', 'getIndentName');
     $this->widgetSchema['folder_id']->setOption('order_by', array('lft', ''));
     if ($this->isNew()) {
         $this->widgetSchema['filename'] = new sfWidgetFormInputFile();
         $this->validatorSchema['filename'] = new lyMediaValidatorFile(array('required' => 'true', 'path' => $this->getOption('upload_root') . sfConfig::get('app_lyMediaManager_media_root', 'media'), 'mime_types' => lyMediaTools::getAllowedMimeTypes(), 'allowed_extensions' => lyMediaTools::getAllowedExtensions()));
         if ($this->getOption('folder_id')) {
             $this->setDefault('folder_id', $this->getOption('folder_id'));
         }
     } else {
         $query = Doctrine_query::create()->from('lyMediaFolder')->where('id != ?', $this->getObject()->getFolder()->getId());
         $this->widgetSchema['folder_id']->setOption('query', $query);
         $this->widgetSchema['folder_id']->setOption('add_empty', 'Move to ...');
         $this->widgetSchema['filename'] = new sfWidgetFormInput();
         $this->validatorSchema['filename'] = new lyMediaValidatorFilename(array('required' => true, 'allowed_extensions' => lyMediaTools::getAllowedExtensions()));
     }
     $this->validatorSchema->setPostValidator(new lyMediaValidatorAsset());
 }
示例#3
0
 public function listar($proceso_id)
 {
     $proceso = Doctrine::getTable('Proceso')->find($proceso_id);
     $reportes = Doctrine_query::create()->from('Reporte r')->where('r.proceso_id = ?', $proceso_id)->orderBy('r.id desc')->execute();
     if ($proceso->cuenta_id != UsuarioBackendSesion::usuario()->cuenta_id) {
         echo 'Usuario no tiene permisos para listar los formularios de este proceso';
         exit;
     }
     $data['proceso'] = $proceso;
     $data['reportes'] = $reportes;
     $data['title'] = 'Documentos';
     $data['content'] = 'backend/reportes/listar';
     $this->load->view('backend/template', $data);
 }
 public function setup()
 {
     parent::setup();
     unset($this['type'], $this['filesize'], $this['created_at'], $this['updated_at']);
     $this->widgetSchema['folder_id']->setOption('method', 'getIndentName');
     if ($this->isNew()) {
         $this->widgetSchema['filename'] = new sfWidgetFormInputFile();
         $this->validatorSchema['filename'] = new lyMediaValidatorFile(array('required' => 'true', 'path' => $this->getOption('upload_root') . sfConfig::get('app_lyMediaManager_media_root', 'media'), 'mime_types' => lyMediaTools::getAllowedMimeTypes(), 'allowed_extensions' => lyMediaTools::getAllowedExtensions()));
         if ($user = $this->getOption('user')) {
             if ($user->getAttribute('view') == 'icons' && $user->getAttribute('folder_id')) {
                 $this->setDefault('folder_id', $user->getAttribute('folder_id'));
             }
         }
     } else {
         $query = Doctrine_query::create()->from('lyMediaFolder')->where('id != ?', $this->getObject()->getFolder()->getId());
         $this->widgetSchema['folder_id']->setOption('query', $query);
         $this->widgetSchema['folder_id']->setOption('add_empty', 'Move to ...');
         $this->widgetSchema['filename'] = new sfWidgetFormInput();
         $this->validatorSchema['filename'] = new lyMediaValidatorFilename(array('required' => true, 'allowed_extensions' => lyMediaTools::getAllowedExtensions()));
         $this->validatorSchema->setPostValidator(new lyMediaValidatorAsset());
     }
 }
示例#5
0
文件: xmlcdr.php 项目: swk/bluebox
 public function index($start_date = 'null', $end_date = 'null')
 {
     // Download a CDR
     // Setup the base grid object
     if ($this->submitted()) {
         $start_date = $this->input->post('startdate');
         $end_date = $this->input->post('enddate');
         $exptype = $this->input->post('exporttype');
         $q = Doctrine_query::create()->select('*')->from('Xmlcdr');
         if ($start_date !== '') {
             $q->andWhere('start_stamp >= ?', $start_date . ' 00:00:00');
         }
         if ($end_date !== '') {
             $q->andWhere('end_stamp <= ?', $end_date . ' 23:59:59');
         }
         $exprecs = $q->execute();
         $this->doexport($exprecs, $exptype);
     }
     $this->grid = jgrid::grid($this->baseModel, array('gridName' => 'downloadrange', 'caption' => 'Call Detail Records', 'sortorder' => 'desc'))->add('xml_cdr_id', 'ID', array('hidden' => true, 'key' => true))->add('start_stamp', 'Start', array('callback' => array($this, 'formatNumber')))->add('end_stamp', 'End', array('callback' => array($this, 'formatNumber')))->add('direction', 'Direction')->add('caller_id_name', 'Caller Name')->add('caller_id_number', 'Caller Number')->add('destination_number', 'Destination', array('callback' => array($this, 'formatNumber')))->add('duration', 'Duration', array('callback' => array($this, 'formatDuration')))->add('hangup_cause', 'Call End Cause')->addAction('xmlcdr/details', 'Details', array('arguments' => 'xml_cdr_id', 'attributes' => array('class' => 'qtipAjaxForm')));
     // Only display records from the domains associated with the account
     $domainlist = Doctrine_Query::create()->select('domain')->from('Location')->fetchArray();
     $inlist = array();
     foreach ($domainlist as $domain) {
         $inlist[] = $domain['domain'];
     }
     $this->grid->whereIn('domain_name', '', $inlist);
     // Filter by starting and ending dates
     if ($start_date !== 'null') {
         $this->grid->andWhere('start_stamp', '>=', $start_date . ' 00:00:00');
     }
     if ($end_date !== 'null') {
         $this->grid->andWhere('end_stamp', '<=', $end_date . ' 23:59:59');
     }
     // Let plugins populate the grid as well
     plugins::views($this);
     // Produce a grid in the view
     $this->view->grid = $this->grid->produce();
 }
 public static function findOneByIdForAdmin($id)
 {
     return Doctrine_query::create()->from('Model_Hm_Block b')->where('b.id = ?', $id);
 }
 /**
  * Custom query string (searches sources and responses)
  *
  * @param Doctrine_query $q
  * @param string $str
  * @param string $root_tbl (optional)
  * @param string $root_alias (optional)
  */
 protected function apply_search($q, $str, $root_tbl = null, $root_alias = null)
 {
     $left = "'" . addslashes($str) . "%'";
     $both = "'%" . addslashes($str) . "%'";
     $wheres = array("(bs.bsrc_notes like {$both})", "(s.src_first_name like {$left} or s.src_last_name like {$left})", "(e.sem_email like {$left})", "(srsi.inq_ext_title like {$both})");
     $q->addWhere('(' . implode(' or ', $wheres) . ')');
 }
 public function getConceptsbyuser()
 {
     $result = Doctrine_query::create()->from('concept')->where('user_id = ?', sfCOntext::getInstance()->getUser()->getGuardUser()->getId())->addWhere('status = "1"')->execute();
     return $result;
 }
 public function getConceptsRelation($id)
 {
     $result = Doctrine_query::create()->from('InvoiceConcept as i')->where('i.invoice_id = ?', $id)->execute();
     return $result;
 }
示例#10
0
 public function ver($reporte_id)
 {
     $reporte = Doctrine::getTable('Reporte')->find($reporte_id);
     if ($reporte->Proceso->cuenta_id != UsuarioBackendSesion::usuario()->cuenta_id) {
         echo 'Usuario no tiene permisos';
         exit;
     }
     // Reporte del proceso
     $proceso = $reporte->Proceso;
     $tramites_completos = 0;
     $tramites_vencidos = 0;
     $tramites_pendientes = 0;
     $etapas_cantidad = 0;
     foreach ($proceso->Tramites as $tramite) {
         $etapas_cantidad = Doctrine_query::create()->from('Etapa e')->where('e.tramite_id = ?', $tramite->id)->count();
         if ($tramite->pendiente == 0) {
             $tramites_completos++;
         } else {
             if ($etapas_cantidad > 0) {
                 if ($tramite->getTareasVencidas()->count() > 0) {
                     $tramites_vencidos++;
                 }
                 $tramites_pendientes++;
             }
         }
     }
     $promedio_tramite = $proceso->getDiasPorTramitesAvg();
     $promedio_tramite = $promedio_tramite[0]['avg'];
     // Parametros
     $query = $this->input->get('query');
     $created_at_desde = $this->input->get('created_at_desde');
     $created_at_hasta = $this->input->get('created_at_hasta');
     $pendiente = $this->input->get('pendiente') !== false ? $this->input->get('pendiente') : -1;
     $formato = $this->input->get('formato');
     $filtro = $this->input->get('filtro');
     $offset = $this->input->get('offset');
     $per_page = 50;
     $params = array();
     if ($created_at_desde) {
         array_push($params, 'created_at >= ' . "'" . date('Y-m-d', strtotime($created_at_desde)) . "'");
     }
     if ($created_at_hasta) {
         array_push($params, 'created_at <= ' . "'" . date('Y-m-d', strtotime($created_at_hasta)) . "'");
     }
     if ($pendiente != -1) {
         array_push($params, 'pendiente = ' . $pendiente);
     }
     if ($query) {
         $this->load->library('sphinxclient');
         $this->sphinxclient->setServer($this->config->item('sphinx_host'), $this->config->item('sphinx_port'));
         $this->sphinxclient->setFilter('proceso_id', array($reporte->Proceso->id));
         $result = $this->sphinxclient->query(json_encode($query), 'tramites');
         if ($result['total'] > 0) {
             $matches = array_keys($result['matches']);
             array_push($params, 't.id IN (' . implode(',', $matches) . ')');
         } else {
             $params = array('0');
         }
     }
     if ($formato == "pdf") {
         $reporte_tabla = $reporte->getReporteAsMatrix($params);
         $this->load->library('pdf');
         $data['tramites_vencidos'] = $tramites_vencidos;
         $data['tramites_pendientes'] = $tramites_pendientes;
         $data['tramites_completos'] = $tramites_completos;
         $data['promedio_tramite'] = $promedio_tramite;
         $data['reporte'] = $reporte_tabla;
         $data['title'] = $reporte->nombre . ' - Proceso "' . $reporte->Proceso->nombre . '"';
         $html = $this->load->view('backend/reportes/pdf', $data, true);
         $pdf = $this->pdf->load();
         $pdf->WriteHtml($html);
         $pdf->Output('reporte.pdf', 'D');
     } else {
         if ($formato == "xls") {
             $reporte_tabla = $reporte->getReporteAsMatrix($params);
             $CI =& get_instance();
             $CI->load->library('Excel_XML');
             $CI->excel_xml->addArray($reporte_tabla);
             $CI->excel_xml->generateXML('reporte');
             return;
         }
     }
     $ntramites = count($reporte->getReporteAsMatrix($params)) - 1;
     $reporte_tabla = $reporte->getReporteAsMatrix($params, $per_page, $offset);
     $this->load->library('pagination');
     $this->pagination->initialize(array('base_url' => site_url('backend/reportes/ver/' . $reporte_id . '?query=' . $query . '&pendiente=' . $pendiente . '&created_at_desde=' . $created_at_desde . '&created_at_hasta=' . $created_at_hasta), 'total_rows' => $ntramites, 'per_page' => $per_page));
     $data['tramites_vencidos'] = $tramites_vencidos;
     $data['tramites_pendientes'] = $tramites_pendientes;
     $data['tramites_completos'] = $tramites_completos;
     $data['promedio_tramite'] = $promedio_tramite;
     $data['filtro'] = $filtro;
     $data['query'] = $query;
     $data['reporte_tabla'] = $reporte_tabla;
     $data['reporte'] = $reporte;
     $data['pendiente'] = $pendiente;
     $data['created_at_desde'] = $created_at_desde;
     $data['created_at_hasta'] = $created_at_hasta;
     $data['title'] = $reporte->nombre . ' - Proceso "' . $reporte->Proceso->nombre . '"';
     $data['content'] = 'backend/reportes/ver';
     $this->load->view('backend/template', $data);
 }
示例#11
0
文件: layout.php 项目: br00k/yavom
		
		<div id="sidebar">
			<? if ($sf_user->getGuardUser()): ?>
			<div class="widget">
				<h2><?php echo __('Profile')?></h2>
				<p><?php echo  $sf_user->getGuardUser()->getLastName(); ?></p>
                                <p><?php echo  link_to(__("My entitlements"),"getMyEntitlements/index") ?></p>
				<p><?php echo  link_to(__("Logout"),"saml/logout"); ?></p>
			</div>
			<div class="widget">
				<h2><?php echo __('My Organizations')?></h2>
                                <? if ($sf_user->getPrincipal()->getOrganization()) : ?>
                                <? $os = $sf_user->getPrincipal()->getOrganization(); ?>
                                <? $ros = $sf_user->getPrincipal()->getRelatedOrganizations(FALSE); ?>
                                <? foreach($os as $o ): ?>
                                  <?php $oe = Doctrine_query::create()->select('oe.id')->from('OrganizationEntitlementPack oe')->where('oe.organization_id=?',$o->getId())->execute(); ?>
				  <p><?php echo  $o ?>
                                  <span class="right">
				  <?php echo  image_tag("icons/user",array("title"=>__("Participants")))?><?php echo  count($o->getInvitation()) ?>
				  <?php echo  image_tag("icons/application_cascade",array("title"=>__("Subscribed services")))?><?php echo  count($oe) ?>
				&nbsp;&nbsp;
                                  <?php echo  link_to(image_tag("icons/wrench",array("class"=>"button","title"=>__("Manage organization"))),"show/index?id=".$o->getId()) ?>
                                  <?php echo  $o->hasPendingService()?image_tag("icons/error",array("title"=>__("Pending service subscribtions"))):"" ?>
                                  </p>
                                <? endforeach ?>
                                <?php foreach($ros as $o) :?>  
                                  <p><?php echo  $o ?>
                                  <span class="right">
                                  <?php echo  link_to(image_tag("icons/group",array("title"=>__('Show organization'))),"show/index?id=".$o->getId()) ?>
                                  </span>
                                  </p>