Пример #1
0
 public function onLoad($param)
 {
     $this->Page->Title = Prado::localize('PersonalData');
     $this->Save->ImageUrl = $this->Page->Theme->BaseUrl . '/images/' . $this->getApplication()->getGlobalization()->Culture . '/save.gif';
     $this->btnCancelSelect->ImageUrl = $this->Page->Theme->BaseUrl . '/images/' . $this->getApplication()->getGlobalization()->Culture . '/cancel.gif';
     $this->btnUpload->ImageUrl = $this->Page->Theme->BaseUrl . '/images/' . $this->getApplication()->getGlobalization()->Culture . '/upload.gif';
     if (!$this->IsPostBack) {
         $this->content->Visible = true;
         $user = $this->User->UserDB;
         $this->Email->Text = $user->email;
         $this->Name->Text = $user->name;
         $this->Surname->Text = $user->surname;
         $this->Telephone->Text = $user->telephone;
         $this->MobileTelephone->Text = $user->mobile_telephone;
         $this->Fax->Text = $user->fax;
         $this->Cost->Text = $user->cost;
         $criteria = new TActiveRecordCriteria();
         $criteria->OrdersBy['description'] = 'asc';
         $brands = TblWeightUnit::finder()->findAll($criteria);
         $this->DDLWeightUnit->DataSource = $brands;
         $this->DDLWeightUnit->dataBind();
         $this->DDLWeightUnit->SelectedValue = $user->tbl_weight_unit_id;
         $brands = TblCurrencyUnit::finder()->findAll($criteria);
         $this->DDLCurrencyUnit->DataSource = $brands;
         $this->DDLCurrencyUnit->dataBind();
         $this->DDLCurrencyUnit->SelectedValue = $user->tbl_currency_unit_id;
         $this->Piva->Text = $user->piva;
         $urlJpg = 'themes/White/images/logo/' . $this->User->UserDB->id . ".jpg";
         $urlPng = 'themes/White/images/logo/' . $this->User->UserDB->id . ".png";
         if (!file_exists($urlJpg)) {
             //if (!file_exists($urlPng))
             $this->ImageLogo->ImageUrl = $this->Page->Theme->BaseUrl . '/images/logo-st-www.jpg';
         } else {
             $this->ImageLogo->ImageUrl = $urlJpg;
         }
     }
     if ($this->User->UserDB->type_user_id == 4) {
         $this->Save->Visible = false;
         $this->btnCancelSelect->Visible = false;
         $this->btnUpload->Visible = false;
     } else {
         $this->Save->Visible = true;
         $this->btnCancelSelect->Visible = true;
         $this->btnUpload->Visible = true;
     }
 }
Пример #2
0
 /**
  * Creates a BlogUser object based on the specified username.
  * This method is required by TDbUser. It checks the database
  * to see if the specified username is there. If so, a BlogUser
  * object is created and initialized.
  * @param string the specified username
  * @return BlogUser the user object, null if username is invalid.
  */
 public function createUser($username)
 {
     // use UserRecord Active Record to look for the specified username
     $userRecord = TblUsers::finder()->findBy_username($username);
     if ($userRecord instanceof TblUsers) {
         $user = new SToolsUser($this->Manager);
         $user->Name = $userRecord->name;
         $user->Surname = $userRecord->surname;
         $user->Active = $userRecord->active;
         $userRecord->currency_unit = TblCurrencyUnit::finder()->findBy_id($userRecord->tbl_currency_unit_id);
         $userRecord->weight_unit = TblWeightUnit::finder()->findBy_id($userRecord->tbl_weight_unit_id);
         $user->UserDB = $userRecord;
         $user->IsGuest = false;
         // the user is not a guest
         return $user;
     } else {
         return null;
     }
 }