public function buildForm()
 {
     $translationLanguages = TranslationLanguageQuery::create()->where('is_active = 1')->find();
     foreach ($translationLanguages as $translationLanguage) {
         $name = $translationLanguage->getName();
         $id = $translationLanguage->getId();
         $this->add($id, 'textarea', ['label' => $name]);
     }
 }
 public function buildForm()
 {
     $translationCatalogs = TranslationCatalogQuery::create()->find();
     $translation_arr = array('' => '');
     foreach ($translationCatalogs as $translationCatalog) {
         $name = $translationCatalog->getName();
         $id = $translationCatalog->getId();
         $translation_arr[$id] = $name;
     }
     $translationLanguages = TranslationLanguageQuery::create()->where('is_active = 1')->where('is_default = 1')->find();
     $this->add('CatalogId', 'select', ['choices' => $translation_arr, 'label' => 'Catalog'])->add('Keyword', 'text');
     foreach ($translationLanguages as $translationLanguage) {
         $language_name = $translationLanguage->getName();
         $this->add($language_name, 'text');
     }
 }
 public function buildForm()
 {
     $translationLanguages = TranslationLanguageQuery::create()->where('is_active = 1')->find();
     $languages = array('' => '');
     foreach ($translationLanguages as $translationLanguage) {
         $name = $translationLanguage->getName();
         $id = $translationLanguage->getId();
         $languages[$id] = $name;
     }
     $adminCredentials = AdminCredentialQuery::create()->orderBySequence()->find();
     $credentials = array('' => '');
     foreach ($adminCredentials as $adminCredential) {
         $name = $adminCredential->getName();
         $id = $adminCredential->getId();
         $credentials[$id] = $name;
     }
     $this->add('Name', 'text')->add('Login', 'text')->add('Email', 'email')->add('Status', 'select', ['choices' => ['' => '', 'NEW' => 'NEW', 'admin' => 'admin', 'professor' => 'professor', 'student' => 'student']])->add('LanguageId', 'select', ['label' => 'Default Language', 'choices' => $languages])->add('CredentialId', 'select', ['label' => 'Credential', 'choices' => $credentials]);
 }
 /**
  * Builds a Criteria object containing the primary key for this object.
  *
  * Unlike buildCriteria() this method includes the primary key values regardless
  * of whether or not they have been modified.
  *
  * @throws LogicException if no primary key is defined
  *
  * @return Criteria The Criteria object containing value(s) for primary key(s).
  */
 public function buildPkeyCriteria()
 {
     $criteria = ChildTranslationLanguageQuery::create();
     $criteria->add(TranslationLanguageTableMap::COL_ID, $this->id);
     return $criteria;
 }
Beispiel #5
0
 /**
  * Set site translation language.
  *
  * @param  int  $language_id
  */
 public static function setLocale($language_id)
 {
     $translationLanguage = TranslationLanguageQuery::create()->findPK($language_id);
     $culture = $translationLanguage->getCulture();
     Session::put('lang', $culture);
 }
 /**
  * Returns a new ChildTranslationLanguageQuery object.
  *
  * @param     string $modelAlias The alias of a model in the query
  * @param     Criteria $criteria Optional Criteria to build the query from
  *
  * @return ChildTranslationLanguageQuery
  */
 public static function create($modelAlias = null, Criteria $criteria = null)
 {
     if ($criteria instanceof ChildTranslationLanguageQuery) {
         return $criteria;
     }
     $query = new ChildTranslationLanguageQuery();
     if (null !== $modelAlias) {
         $query->setModelAlias($modelAlias);
     }
     if ($criteria instanceof Criteria) {
         $query->mergeWith($criteria);
     }
     return $query;
 }
Beispiel #7
0
 /**
  * Get the associated ChildTranslationLanguage object
  *
  * @param  ConnectionInterface $con Optional Connection object.
  * @return ChildTranslationLanguage The associated ChildTranslationLanguage object.
  * @throws PropelException
  */
 public function getTranslationLanguage(ConnectionInterface $con = null)
 {
     if ($this->aTranslationLanguage === null && $this->language_id !== null) {
         $this->aTranslationLanguage = ChildTranslationLanguageQuery::create()->findPk($this->language_id, $con);
         /* The following can be used additionally to
               guarantee the related object contains a reference
               to this object.  This level of coupling may, however, be
               undesirable since it could result in an only partially populated collection
               in the referenced object.
               $this->aTranslationLanguage->addAdminUsers($this);
            */
     }
     return $this->aTranslationLanguage;
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id, FormBuilder $formBuilder)
 {
     $translation_arr = array();
     $translationKeyword = TranslationKeywordQuery::create()->findPK($id);
     $translation_arr['Id'] = $id;
     $translation_arr['CatalogId'] = $translationKeyword->getCatalogId();
     $translation_arr['Keyword'] = $translationKeyword->getKeyword();
     $translationLanguages = TranslationLanguageQuery::create()->where('is_active = 1')->find();
     $keyword_id = $translationKeyword->getId();
     foreach ($translationLanguages as $translationLanguage) {
         $language = $translationLanguage->getName();
         $language_id = $translationLanguage->getId();
         $translationLanguageKeyword = TranslationLanguageKeywordQuery::create()->where('keyword_id = ' . $keyword_id)->where('language_id = ' . $language_id)->findOne();
         $translation_arr['Languages'][$language_id] = is_null($translationLanguageKeyword) ? '' : $translationLanguageKeyword->getTranslation();
     }
     $form = $formBuilder->create('App\\Forms\\TranslationKeywordForm', ['method' => 'PATCH', 'action' => ['TranslationController@update', $id], 'model' => $translation_arr]);
     $form_name = 'TRANSLATION';
     $action = 'EDIT_OBJ';
     $path = $this->main_page;
     $back = $this->main_page;
     session(['attribute' => \Lang::get('general.TRANSLATION')]);
     return view('manage', compact('form', 'form_name', 'action', 'path', 'back'));
 }
 /**
  * Create a new AdminUserList instance.
  *
  * @return bool
  */
 public function __construct($request, $path, $page)
 {
     $this->translationLanguage = TranslationLanguageQuery::create()->where('is_active = 1')->where('is_default = 1')->findOne();
     $this->keys = array('#', 'catalog', 'keyword', $this->translationLanguage->getName());
     $this->createList($request, $path, $page);
 }
Beispiel #10
0
 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array  $data
  * @return User
  */
 public function create(array $data)
 {
     $translationLanguage = TranslationLanguageQuery::create()->where('is_active = 1')->findOne();
     return User::create(['name' => $data['name'], 'login' => $data['login'], 'email' => $data['email'], 'language_id' => $translationLanguage->getId(), 'password' => bcrypt($data['password'])]);
 }
 /**
  * Performs an INSERT on the database, given a TranslationLanguage or Criteria object.
  *
  * @param mixed               $criteria Criteria or TranslationLanguage object containing data that is used to create the INSERT statement.
  * @param ConnectionInterface $con the ConnectionInterface connection to use
  * @return mixed           The new primary key.
  * @throws PropelException Any exceptions caught during processing will be
  *                         rethrown wrapped into a PropelException.
  */
 public static function doInsert($criteria, ConnectionInterface $con = null)
 {
     if (null === $con) {
         $con = Propel::getServiceContainer()->getWriteConnection(TranslationLanguageTableMap::DATABASE_NAME);
     }
     if ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
         // rename for clarity
     } else {
         $criteria = $criteria->buildCriteria();
         // build Criteria from TranslationLanguage object
     }
     if ($criteria->containsKey(TranslationLanguageTableMap::COL_ID) && $criteria->keyContainsValue(TranslationLanguageTableMap::COL_ID)) {
         throw new PropelException('Cannot insert a value for auto-increment primary key (' . TranslationLanguageTableMap::COL_ID . ')');
     }
     // Set the correct dbName
     $query = TranslationLanguageQuery::create()->mergeWith($criteria);
     // use transaction because $criteria could contain info
     // for more than one table (I guess, conceivably)
     return $con->transaction(function () use($con, $query) {
         return $query->doInsert($con);
     });
 }