Exemplo n.º 1
0
 public function testGetObjCultureWithObject()
 {
     $objCulture = new Culture();
     $objCulture->setCulture('pt_BR');
     $this->objContent->setCulture($objCulture);
     $test = $this->objContent->getObjCulture()->getCulture();
     $this->assertEquals('pt_BR', $test);
 }
Exemplo n.º 2
0
 public function executeCulture(Content &$objContent)
 {
     $objCulture = new Culture();
     $culture = $objCulture->checkCulture($this->getRequestParameter('isolang'));
     $objContent->getObjCulture()->setCulture($culture);
     $module = $this->getRequestParameter('module');
     $action = $this->getRequestParameter('action');
     $this->redirectIndoor($module, $action);
 }
Exemplo n.º 3
0
 /**
  * Performs the translation
  * @param String $tag
  * @param String $culture
  * @return String
  */
 public static function translate($tag, $culture = null)
 {
     $objCulture = new Culture();
     $culture = $objCulture->checkCulture($culture);
     $arrayXml = I18nXml::read($culture);
     $count = count($arrayXml);
     for ($i = 0; $i < $count; $i++) {
         if ($arrayXml[$i]->tag == $tag) {
             return $arrayXml[$i]->i18n;
         }
     }
     return $tag;
 }
Exemplo n.º 4
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $action = Input::get('action');
     $workUp = new Culture();
     $workUp->user_id = Input::get('userId');
     $workUp->test_id = Input::get('testId');
     $workUp->observation = Input::get('obs');
     if ($action == 'add') {
         $workUp->save();
         return 0;
     } else {
         if ($action == 'draw') {
             $obsv = Test::find($workUp->test_id)->culture;
             foreach ($obsv as $observation) {
                 $observation->user = User::find($observation->user_id)->name;
                 $observation->timeStamp = Culture::showTimeAgo($observation->created_at);
             }
             return json_encode($obsv);
         }
     }
 }
Exemplo n.º 5
0
 public function testRetriveDefaultCultureError()
 {
     $criteria = new Criteria();
     $Culture = new CulturePeer();
     $criteria->add(CulturePeer::DEFAULT_CULTURE, true);
     $objCulture = $Culture->doSelectOne($criteria);
     $objCulture->setDefault(false);
     $objCulture->save();
     $test = Culture::retriveDefaultCulture();
     $criteria->clear();
     $criteria->add(CulturePeer::ISOLANG, 'pt_BR');
     $objCulture = new Culture();
     $objCulture = $objCulture->doSelectOne($criteria);
     $objCulture->setDefault(true);
     $objCulture->save();
     $this->assertEquals('pt_BR', $test);
 }
Exemplo n.º 6
0
 /**
  * 
  * @param $isoLang
  */
 public static function retriveByPk($isoLang = 'pt_BR')
 {
     $criteria = new Criteria();
     $criteria->add(self::ISOLANG, $isoLang);
     $criteria->setLimit(1);
     $culture = new Culture();
     $obj = $culture->doSelectOne($criteria);
     return $obj;
 }
Exemplo n.º 7
0
 /**
  * List all cultures or based on category if specified
  */
 public function get_index()
 {
     $cultures = Culture::get();
     return json_encode($cultures);
 }