Пример #1
0
 /**
  * Process rowId to use in where condition.
  * @return string String with formatted where condition.
  */
 protected function whereData($id)
 {
     $where = array();
     /**
      * If multiple rows are selected then their primary keys are seprated by ','
      * So here seprating primary keys 
      */
     $primaryKeys = explode(',', $id);
     foreach ($primaryKeys as $key => $tupleKey) {
         /*
          * If primary key is composite then cols are seprated by '__'
          * So here seprating cols of a composite key
          */
         $primaryKeys[$key] = explode('__', $tupleKey);
         //$pkey begin from location 1
         array_unshift($primaryKeys[$key], 'faaltoo');
     }
     /*
     		
     			$this->_helper->logger ( 'Primary Keys of grid in whereData()' );
     			$this->_helper->logger ( $primaryKeys );*/
     /*
      * Create where condition
      */
     $where = '';
     $pkey = $this->model->info('primary');
     /*
     		
     			$this->_helper->logger ( 'Primary Keys of db in whereData()' );
     			$this->_helper->logger ( $pkey );*/
     $setOr = false;
     foreach ($primaryKeys as $num => $tupleKey) {
         if ($setOr) {
             $where .= ' OR ';
         }
         $setAnd = false;
         $where .= ' ( ';
         foreach ($pkey as $num => $col) {
             if ($setAnd) {
                 $where .= ' AND ';
             }
             $where .= $this->model->getAdapter()->quoteInto("{$col} = ?", $tupleKey[$num]);
             $setAnd = true;
         }
         $where .= ' ) ';
         $setOr = true;
     }
     /*
     			$this->_helper->logger ( '#where condition in whereData()' );
     			$this->_helper->logger ( $where );*/
     return $where;
 }