/**
  *
  * getWarning $query are in the form:
  * <pre>
  * Array
  * (
  * [0] => Array
  *     (
  *         [id_segment] => 2224900
  *     ),
  * [1] => Array
  *     (
  *         [id_segment] => 2224903
  *     ),
  * )
  * </pre>
  */
 private function __globalWarningsCall()
 {
     $result = getWarning($this->__postInput->id_job, $this->__postInput->password);
     foreach ($result as $position => &$item) {
         $item = $item['id_segment'];
     }
     $this->result['details'] = array_values($result);
     $this->result['token'] = $this->__postInput->token;
     //        $msg = 'MateCat will be undergoing scheduled maintenance starting on Saturday, December 13 at 11:50 PM CEST. MateCat will be unavailable for approximately 4 hours.<br /> We apologize for any inconvenience. For any questions, contact us support@matecat.com.';
     //        $this->result['messages']  = '[{"msg":"' . $msg . '", "token":"' . md5($msg) . '", "expire":"2014-12-14 04:00:00"}]';
     $tMismatch = getTranslationsMismatches($this->__postInput->id_job, $this->__postInput->password);
     //        Log::doLog( $tMismatch );
     $result = array('total' => count($tMismatch), 'mine' => 0, 'list_in_my_job' => array());
     foreach ($tMismatch as $row) {
         if (!empty($row['first_of_my_job'])) {
             $result['mine']++;
             $result['list_in_my_job'][] = $row['first_of_my_job'];
             //                $result['list_in_my_job'][] = array_shift( explode( "," , $row['first_of_my_job'] ) );
             //append to global list
             $this->result['details'][] = $row['first_of_my_job'];
             //                $this->result[ 'details' ] = array_merge( $this->result[ 'details' ], explode( "," , $row['first_of_my_job'] )  )
         }
     }
     //???? php maps internally numerical keys of array_unique as string so with json_encode
     //it become an object and not an array!!
     $this->result['details'] = array_values(array_unique($this->result['details']));
     $this->result['translation_mismatches'] = $result;
 }
 /**
  * When Called it perform the controller action to retrieve/manipulate data
  *
  * @return mixed
  */
 function doAction()
 {
     $this->parseIDSegment();
     $_thereArePossiblePropagations = countThisTranslatedHashInJob($this->id_job, $this->password, $this->id_segment);
     $thereArePossiblePropagations = intval($_thereArePossiblePropagations['available']);
     $Translation_mismatches = array();
     if ($thereArePossiblePropagations) {
         $Translation_mismatches = getTranslationsMismatches($this->id_job, $this->password, $this->id_segment);
     }
     $result = array('editable' => array(), 'not_editable' => array(), 'prop_available' => $thereArePossiblePropagations);
     foreach ($Translation_mismatches as $position => $row) {
         if ($row['editable']) {
             $result['editable'][] = array('translation' => CatUtils::rawxliff2view($row['translation']), 'TOT' => $row['TOT'], 'involved_id' => explode(",", $row['involved_id']));
         } else {
             $result['not_editable'][] = array('translation' => CatUtils::rawxliff2view($row['translation']), 'TOT' => $row['TOT'], 'involved_id' => explode(",", $row['involved_id']));
         }
     }
     $this->result['code'] = 1;
     $this->result['data'] = $result;
 }
 /**
  *
  * getWarning $query are in the form:
  * <pre>
  * Array
  * (
  * [0] => Array
  *     (
  *         [id_segment] => 2224900
  *     ),
  * [1] => Array
  *     (
  *         [id_segment] => 2224903
  *     ),
  * )
  * </pre>
  */
 private function __globalWarningsCall()
 {
     $this->result['token'] = $this->__postInput->token;
     try {
         $result = getWarning($this->__postInput->id_job, $this->__postInput->password);
     } catch (Exception $e) {
         $this->result['details'] = array();
         $this->result['translation_mismatches'] = array('total' => 0, 'mine' => 0, 'list_in_my_job' => array());
         return;
     }
     foreach ($result as $position => &$item) {
         $item = $item['id_segment'];
     }
     $this->result['messages'] = $this->getGlobalMessage();
     $this->result['details'] = array_values($result);
     $tMismatch = getTranslationsMismatches($this->__postInput->id_job, $this->__postInput->password);
     //        Log::doLog( $tMismatch );
     $result = array('total' => count($tMismatch), 'mine' => 0, 'list_in_my_job' => array());
     foreach ($tMismatch as $row) {
         if (!empty($row['first_of_my_job'])) {
             $result['mine']++;
             $result['list_in_my_job'][] = $row['first_of_my_job'];
             //                $result['list_in_my_job'][] = array_shift( explode( "," , $row['first_of_my_job'] ) );
             //append to global list
             $this->result['details'][] = $row['first_of_my_job'];
             //                $this->result[ 'details' ] = array_merge( $this->result[ 'details' ], explode( "," , $row['first_of_my_job'] )  )
         }
     }
     //???? php maps internally numerical keys of array_unique as string so with json_encode
     //it become an object and not an array!!
     $this->result['details'] = array_values(array_unique($this->result['details']));
     $this->result['translation_mismatches'] = $result;
 }