Esempio n. 1
0
	public static function getParametersForList($proxed)
	{
		$parameters = parent::getParametersForList($proxed);

		$fldSubMap = static::readMap(self::getEntityRoadCode(), 'list');
		$roadMap = static::getEntityRoadMap();
		$road = $roadMap[self::getEntityRoadCode()]['name'];
		$class = $road.'Table';
		$languages = self::getLanguageList();

		// select

		foreach($languages as $lang)
		{
			$lang = ToUpper($lang);

			$parameters['runtime']['NAME__'.$lang] = array(
				'data_type' => $road,
				'reference' => array(
					'=this.ID' => 'ref.'.$class::getReferenceFieldName(),
					'=ref.'. $class::getLanguageFieldName() => array('?', ToLower($lang)) // oracle is case-sensitive
				),
				'join_type' => 'left'
			);

			if(!isset($parameters['select']))
				$parameters['select'] = array();
			foreach($fldSubMap as $code => $fld)
				$parameters['select'][$code.'_'.$lang] = 'NAME__'.$lang.'.'.$code;
		}

		// filter
		if(is_array($proxed['FILTER']) && !empty($proxed['FILTER']))
		{
			foreach($languages as $lang)
			{
				$lang = ToUpper($lang);

				foreach($fldSubMap as $code => $fld)
				{
					$key = $code.'_'.$lang;

					if(isset($proxed['FILTER'][$key]))
						$parameters['filter'][static::getFilterModifier($fld['data_type']).'NAME__'.$lang.'.'.$code] = $proxed['FILTER'][$key];
				}
			}
		}

		return $parameters;
	}
Esempio n. 2
0
 public static function performGridOperations($parameters)
 {
     $result = array('sucess' => true, 'errors' => array());
     @set_time_limit(0);
     if (is_array($parameters['ID']) && !empty($parameters['ID'])) {
         $parameters['ID'] = array_unique($parameters['ID']);
         foreach ($parameters['ID'] as $id) {
             $res = static::delete($id);
             if (!$res['success']) {
                 $result['success'] = false;
                 $result['errors'] = array_merge($result['errors'], $res['errors']);
             }
         }
     } else {
         if (is_array($parameters['FILTER'])) {
             $entityClass = static::getEntityClass();
             $parameters = Helper::getParametersForList($parameters);
             // from generalized to orm
             $resItems = $entityClass::getList(array('filter' => $parameters['filter'], 'select' => array('ID')));
             while ($item = $resItems->fetch()) {
                 $res = static::delete($item['ID']);
                 if (!$res['success']) {
                     $result['success'] = false;
                     $result['errors'] = array_merge($result['errors'], $res['errors']);
                 }
             }
         }
     }
     return $result;
 }