Esempio n. 1
0
 /**
  * Retrieve detailled informations about a basket element
  *
  * @param  BasketElement $basket_element
  *
  * @return type
  */
 private function list_basket_element(Application $app, BasketElement $basket_element)
 {
     $ret = ['basket_element_id' => $basket_element->getId(), 'order' => $basket_element->getOrd(), 'record' => $this->list_record($app, $basket_element->getRecord($app)), 'validation_item' => null != $basket_element->getBasket()->getValidation()];
     if ($basket_element->getBasket()->getValidation()) {
         $choices = [];
         $agreement = null;
         $note = '';
         foreach ($basket_element->getValidationDatas() as $validation_datas) {
             $participant = $validation_datas->getParticipant();
             $user = $participant->getUser();
             /* @var $validation_datas ValidationData */
             $choices[] = ['validation_user' => ['usr_id' => $user->getId(), 'usr_name' => $user->getDisplayName(), 'confirmed' => $participant->getIsConfirmed(), 'can_agree' => $participant->getCanAgree(), 'can_see_others' => $participant->getCanSeeOthers(), 'readonly' => $user->getId() != $app['authentication']->getUser()->getId(), 'user' => $this->list_user($user)], 'agreement' => $validation_datas->getAgreement(), 'updated_on' => $validation_datas->getUpdated()->format(DATE_ATOM), 'note' => null === $validation_datas->getNote() ? '' : $validation_datas->getNote()];
             if ($user->getId() == $app['authentication']->getUser()->getId()) {
                 $agreement = $validation_datas->getAgreement();
                 $note = null === $validation_datas->getNote() ? '' : $validation_datas->getNote();
             }
             $ret['validation_choices'] = $choices;
         }
         $ret['agreement'] = $agreement;
         $ret['note'] = $note;
     }
     return $ret;
 }
 /**
  * {@inheritDoc}
  */
 public function getValidationDatas()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getValidationDatas', array());
     return parent::getValidationDatas();
 }