Example #1
0
 /**
  * 
  * @param type $parameterNames
  * @param type $count
  * @param type $offset
  * @param type $order
  * @param type $sort
  * @param array $filters
  * @param type $filterType
  * @return type
  */
 public static function getList($parameterNames = "*", $count = -1, $offset = 0, $order = null, $sort = "ASC", $filters = array(), $filterType = "OR", $tablesString = null, $staticFilter = null, $aAddFilters = array(), $aGroup = array())
 {
     if (is_null($staticFilter)) {
         $staticFilter = "user_id IS NULL";
     }
     return parent::getList($parameterNames, $count, $offset, $order, $sort, $filters, $filterType, $tablesString, $staticFilter, $aAddFilters, "");
 }
 /**
  * 
  * @param type $parameterNames
  * @param type $count
  * @param type $offset
  * @param type $order
  * @param type $sort
  * @param array $filters
  * @param type $filterType
  * @return type
  */
 public static function getListBySearch($parameterNames = "*", $count = -1, $offset = 0, $order = null, $sort = "ASC", $filters = array(), $filterType = "OR")
 {
     $filters['activate'] = '1';
     $aAddFilters = array();
     $tablesString = null;
     if (array('tagname', array_values($filters)) && !empty($filters['tagname'])) {
         $aAddFilters = array('tables' => array('cfg_tags', 'cfg_tags_bas'), 'join' => array('cfg_tags.tag_id = cfg_tags_bas.tag_id', 'cfg_tags_bas.resource_id = cfg_bam.ba_id '));
     }
     return parent::getListBySearch($parameterNames, $count, $offset, $order, $sort, $filters, $filterType, $tablesString, null, $aAddFilters);
 }
Example #3
0
 /**
  *
  * @param type $parameterNames
  * @param type $count
  * @param type $offset
  * @param type $order
  * @param type $sort
  * @param array $filters
  * @param type $filterType
  * @return type
  */
 public static function getListBySearch($parameterNames = "*", $count = -1, $offset = 0, $order = null, $sort = "ASC", $filters = array(), $filterType = "OR")
 {
     $aAddFilters = array();
     $tablesString = null;
     $aGroup = array();
     if (isset($filters['fullname']) && !empty($filters['fullname'])) {
         $filters['CONCAT(firstname," ",lastname)'] = $filters['fullname'];
         unset($filters['fullname']);
     }
     return parent::getList($parameterNames, $count, $offset, $order, $sort, $filters, $filterType, $tablesString, null, $aAddFilters, $aGroup);
 }
Example #4
0
 /**
  * 
  * @param type $parameterNames
  * @param type $count
  * @param type $offset
  * @param type $order
  * @param type $sort
  * @param array $filters
  * @param type $filterType
  * @return type
  */
 public static function getList($parameterNames = "*", $count = -1, $offset = 0, $order = null, $sort = "ASC", $filters = array(), $filterType = "OR")
 {
     $aAddFilters = array();
     $aGroup = array();
     if (array('tagname', array_values($filters)) && !empty($filters['tagname'])) {
         $aAddFilters = array('tables' => array('cfg_tags', 'cfg_tags_contacts'), 'join' => array('cfg_tags.tag_id = cfg_tags_contacts.tag_id', 'cfg_tags_contacts.resource_id = cfg_contacts.contact_id '));
     }
     if (isset($filters['tagname']) && count($filters['tagname']) > 1) {
         $aGroup = array('sField' => 'cfg_tags_contacts.resource_id', 'nb' => count($filters['tagname']));
     }
     return parent::getList($parameterNames, $count, $offset, $order, $sort, $filters, $filterType, null, null, $aAddFilters, $aGroup);
 }
Example #5
0
 /**
  *
  * @param type $parameterNames
  * @param type $count
  * @param type $offset
  * @param type $order
  * @param type $sort
  * @param array $filters
  * @param type $filterType
  * @return type
  */
 public static function getListBySearch($parameterNames = "*", $count = -1, $offset = 0, $order = null, $sort = "ASC", $filters = array(), $filterType = "OR")
 {
     $aAddFilters = array();
     $tablesString = null;
     $aGroup = array();
     // Filter by service template
     if (isset($filters['svc_tmpl_id']) && !empty($filters['svc_tmpl_id'])) {
         $serviceTemplateId = Servicetemplate::getIdByParameter('service_description', $filters['svc_tmpl_id'], array(), 'LIKE');
         unset($filters['svc_tmpl_id']);
         if (count($serviceTemplateId)) {
             foreach ($serviceTemplateId as $id) {
                 $filters['svc_tmpl_id'][] = $id;
             }
         } else {
             $count = 0;
         }
     }
     return parent::getListBySearch($parameterNames, $count, $offset, $order, $sort, $filters, $filterType, $tablesString, null, $aAddFilters, $aGroup);
 }
Example #6
0
 /**
  *
  * @param type $parameterNames
  * @param type $count
  * @param type $offset
  * @param type $order
  * @param type $sort
  * @param array $filters
  * @param type $filterType
  * @return type
  */
 public static function getListBySearch($parameterNames = "*", $count = -1, $offset = 0, $order = null, $sort = "ASC", $filters = array(), $filterType = "OR")
 {
     $aAddFilters = array();
     $tablesString = null;
     $aGroup = array();
     // Filter by kpi name
     if (isset($filters['object']) && !empty($filters['object'])) {
         $indicatorsName = IndicatorRepository::getIndicatorsName($filters['object']);
         if (count($indicatorsName)) {
             foreach ($indicatorsName as $indicatorName) {
                 $filters['kpi_id'][] = $indicatorName['id'];
             }
         } else {
             $count = 0;
         }
         unset($filters['object']);
     }
     return parent::getListBySearch($parameterNames, $count, $offset, $order, $sort, $filters, $filterType, $tablesString, null, $aAddFilters, $aGroup);
 }
Example #7
0
 /**
  * @param string $paramName
  * @param array $paramValues
  * @param array $extraConditions
  * @return array
  */
 public static function getIdByParameter($paramName, $paramValues = array(), $extraConditions = array())
 {
     $extraConditions['host_register'] = '0';
     return parent::getIdByParameter($paramName, $paramValues, $extraConditions);
 }
Example #8
0
 /**
  * 
  * @param type $parameterNames
  * @param type $count
  * @param type $offset  
  * @param type $order
  * @param type $sort
  * @param array $filters  
  * @param type $filterType
  * @return type
  */
 public static function getListBySearch($parameterNames = "*", $count = -1, $offset = 0, $order = null, $sort = "ASC", $filters = array(), $filterType = "OR")
 {
     $filters['s.enabled'] = '1';
     $aAddFilters = array();
     $tablesString = null;
     $aGroup = array();
     if (array('tagname', array_values($filters)) && !empty($filters['tagname'])) {
         $aAddFilters['tables'][] = 'cfg_tags';
         $aAddFilters['join'][] = 'cfg_tags.tag_id = cfg_tags_services.tag_id';
         $aAddFilters['tables'][] = 'cfg_tags_services';
         $aAddFilters['join'][] = 'cfg_tags_services.resource_id = s.service_id';
     }
     if (isset($filters['tagname']) && count($filters['tagname']) > 1) {
         $aGroup = array('sField' => 'cfg_tags_services.resource_id', 'nb' => count($filters['tagname']));
     }
     if (isset($filters['host_id']) && !empty($filters['host_id'])) {
         $aAddFilters['tables'][] = 'rt_hosts';
         $aAddFilters['join'][] = 'rt_hosts.host_id = s.host_id';
     }
     if (isset($filters['state'])) {
         $filters['s.state'] = $filters['state'];
         unset($filters['state']);
     }
     if (isset($filters['host_id'])) {
         $filters['name'] = $filters['host_id'];
         unset($filters['host_id']);
     }
     return parent::getList($parameterNames, $count, $offset, $order, $sort, $filters, $filterType, $tablesString, null, $aAddFilters, $aGroup);
 }
Example #9
0
 /**
  * @param string $paramName
  * @param array $paramValues
  * @param array $extraConditions
  * @return array
  */
 public static function getIdByParameter($paramName, $paramValues = array(), $extraConditions = array(), $conditionType = '=')
 {
     $extraConditions['service_register'] = '0';
     return parent::getIdByParameter($paramName, $paramValues, $extraConditions, $conditionType);
 }
Example #10
0
 /**
  *
  * @param type $parameterNames
  * @param type $count
  * @param type $offset
  * @param type $order
  * @param type $sort
  * @param array $filters
  * @param type $filterType
  * @return type
  */
 public static function getListBySearch($parameterNames = "*", $count = -1, $offset = 0, $order = null, $sort = "ASC", $filters = array(), $filterType = "OR")
 {
     $aAddFilters = array();
     $tablesString = null;
     $aGroup = array();
     if ($parameterNames != '*' && $count != -1) {
         $aParam = explode(",", $parameterNames);
         $aParam = array_diff($aParam, array(''));
         $aParam = array_map("self::concatNameTable", $aParam);
         $parameterNames = implode(",", $aParam);
     }
     // Add join on node table
     if (isset($filters['ip_address']) && !empty($filters['ip_address'])) {
         $aAddFilters['tables'][] = 'cfg_nodes n';
         $aAddFilters['join'][] = static::$table . '.node_id = n.node_id';
     }
     // Add join on instance table
     if (isset($filters['running']) && !empty($filters['running']) || isset($filters['version']) && !empty($filters['version'])) {
         $aAddFilters['tables'][] = 'rt_instances i';
         $aAddFilters['join'][] = static::$table . '.name = i.name';
     }
     // Avoid error on ambiguous column
     if (isset($filters['name'])) {
         $sField = static::$table . '.name';
         $filters[$sField] = $filters['name'];
         unset($filters['name']);
     }
     // Avoid error on ambiguous column
     if (isset($filters['enable'])) {
         $sField = static::$table . '.enable';
         $filters[$sField] = $filters['enable'];
         unset($filters['enable']);
     }
     return parent::getList($parameterNames, $count, $offset, $order, $sort, $filters, $filterType, $tablesString, null, $aAddFilters, $aGroup);
 }
Example #11
0
 /**
  *
  * @param type $parameterNames
  * @param type $count
  * @param type $offset
  * @param type $order
  * @param type $sort
  * @param array $filters
  * @param type $filterType
  * @return type
  */
 public static function getList($parameterNames = "*", $count = -1, $offset = 0, $order = null, $sort = "ASC", $filters = array(), $filterType = "OR")
 {
     $filters['activate'] = '1';
     $filters['current_status'] = array('0', '1', '2');
     return parent::getList($parameterNames, $count, $offset, $order, $sort, $filters, $filterType);
 }