public function actionStadtraetInnenPersonen() { if (!$this->binContentAdmin()) { $this->errorMessageAndDie(403, ""); } $this->top_menu = "admin"; if (AntiXSS::isTokenSet("save")) { /** @var Person $person */ $person = Person::model()->findByPk($_REQUEST["person"]); if ($person) { if (isset($_REQUEST["fraktion"])) { $person->typ = Person::$TYP_FRAKTION; $person->ris_stadtraetIn = null; } else { $person->typ = Person::$TYP_PERSON; $person->ris_stadtraetIn = isset($_REQUEST["stadtraetIn"]) ? $_REQUEST["stadtraetIn"] : null; } $person->save(); } $this->msg_ok = "Gespeichert"; } /** @var Person[] $personen */ $personen = Person::model()->findAll(["order" => "name"]); /** @var StadtraetIn[] $stadtraetInnen */ $stadtraetInnen = StadtraetIn::model()->findAll(["order" => "name"]); $this->render("stadtraetInnenPersonen", ["personen" => $personen, "stadtraetInnen" => $stadtraetInnen]); }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new Device(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Device'])) { $model->attributes = $_POST['Device']; $model->status = 1; if (Person::model()->findByPk($model->person_id)->company_id == User::getMyCompany() || Yii::app()->user->role == 1) { if ($model->save()) { $fp = fopen('images/barcode/' . $model->barcode . '.png', 'wb'); // Открываем файл $ch = curl_init("http://barcode.tec-it.com/barcode.ashx?translate-esc=off&data={$model->barcode}&code=Code128&unit=Fit&dpi=96&imagetype=Png&rotation=0&color=000000&bgcolor=FFFFFF&qunit=Mm&quiet=0"); curl_setopt($ch, CURLOPT_FILE, $fp); // Передаём дескриптор файла, туда сбросится результат curl_setopt($ch, CURLOPT_HEADER, 0); curl_exec($ch); curl_close($ch); fclose($fp); //Перечмодим файлик chmod('images/barcode/' . $model->barcode . '.png', 0777); //Теперь мы его обрежем, чтобы не нам не мешал водознак UserFunctions::crop('images/barcode/' . $model->barcode . '.png'); $this->redirect(array('view', 'id' => $model->id)); } } else { throw new CHttpException(403, 'Вы не имеете прав в этой организации'); } } $this->render('create', array('model' => $model)); }
public function getAllImage() { $model = Person::model()->findAll(); foreach ($model as $m) { $mas[] = $m['img']; } return array_unique($mas); }
protected function newPasswordEmail() { $owner = $this->getOwner(); $template = SettingsEmailTemplate::model()->getRow('*', '`key`=:t1', array(':t1' => SettingsEmailTemplate::KEY_RESET_PASSWORD)); if (empty($template)) { return FALSE; } $site_name = Yii::app()->settings->get(Constants::CATEGORY_GENERAL, Constants::KEY_SITE_NAME, Yii::app()->name); //placeholders: {name},{link},{username} {email},{password}, $body = Common::myStringReplace($template['body'], array('{name}' => Person::model()->get($owner->id, 'CONCAT(`first_name`," ",`last_name`)'), '{link}' => Yii::app()->createAbsoluteUrl('auth/default/login'), '{username}' => $owner->username, '{email}' => $owner->email, '{password}' => $owner->genericField)); MsgEmailOutbox::model()->push(array('from_name' => $site_name, 'from_email' => $template['from'], 'to_email' => $owner->email, 'subject' => $template['subject'], 'message' => $body)); }
/** * Displays list on persons that have same firstname as person with given id */ public function actionListPersonsWithSameFirstname() { if (isset($_GET['id'])) { $model = Person::model()->findbyPk($_GET['id']); } if ($model !== null) { $models = Person::model()->findAll("firstname='{$model->firstname}'"); $data = array(); foreach ($models as $model) { $data[] = $model->fullname; } echo Yii::t('ui', 'Persons with same firstname: ') . implode(', ', $data); } }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $id = Yii::app()->user->id; $user_model = Users::model()->loadModel($id); $person_model = Person::model()->loadModel($id); $address_model = PersonAddress::model()->find('`person_id`=:t1', array(':t1' => $id)); if (NULL === $address_model) { $address_model = new PersonAddress(); $address_model->person_id = $id; } $models = $this->modelsLoop(); $models = $this->addNewModel($models, $this->modelSave($models)); $this->render('application.modules.users.views.default.view', array('user_model' => $user_model, 'person_model' => $person_model, 'address_model' => $address_model, 'models' => $models, 'jamaa' => Person::model()->findByPk($_REQUEST['id']), 'child' => DependentMembers::model()->dependents($id, 5) || DependentMembers::model()->dependents($id, 10), 'spouse' => DependentMembers::model()->dependents($id, 4) || DependentMembers::model()->dependents($id, 9), 'prnts' => DependentMembers::model()->dependents($id, 1) || DependentMembers::model()->dependents($id, 6), 'inlaws' => DependentMembers::model()->dependents($id, 2) || DependentMembers::model()->dependents($id, 7), 'siblings' => DependentMembers::model()->dependents($id, 3) || DependentMembers::model()->dependents($id, 8), 'action' => Users::ACTION_ADD_DEPENDENTS, 'render' => 'application.modules.members.views.dependentMembers.create')); }
public function sendEmail() { $this->user_model->password_reset_code = Common::generateSalt(); $this->user_model->password_reset_request_date = date('Y-m-d H:i:s'); $this->user_model->save(false); $template = SettingsEmailTemplate::model()->getRow('*', '`key`=:t1', array(':t1' => SettingsEmailTemplate::KEY_FORGOT_PASSWORD)); if (empty($template)) { return FALSE; } //placeholders : {name},{link} $body = Common::myStringReplace($template['body'], array('{name}' => Person::model()->get($this->user_model->id, 'CONCAT(first_name," ",last_name)'), '{link}' => Yii::app()->createAbsoluteUrl('auth/default/resetPassword', array('id' => $this->user_model->id, 'token' => $this->user_model->password_reset_code)))); //$from, $this->user_model->email, $template->title, $template->body, true MsgEmailOutbox::model()->push(array('from_name' => Yii::app()->settings->get(Constants::CATEGORY_GENERAL, Constants::KEY_SITE_NAME, Yii::app()->name), 'from_email' => $template['from'], 'to_email' => $this->user_model->email, 'subject' => $template['subject'], 'message' => $body)); }
/** * @param string $name * @param string $name_normalized * @return Person * @throws Exception */ public static function getOrCreate($name, $name_normalized) { /** @var Person|null $pers */ $pers = Person::model()->findByAttributes(["name_normalized" => $name_normalized]); if (is_null($pers)) { $pers = new Person(); $pers->name = $name; $pers->name_normalized = $name_normalized; $pers->typ = static::$TYP_SONSTIGES; if (!$pers->save()) { RISTools::send_email(Yii::app()->params['adminEmail'], "Person:getOrCreate Error", print_r($pers->getErrors(), true), null, "system"); throw new Exception("Fehler beim Speichern: Person"); } } return $pers; }
/** * @return bool */ public function isAdminCurUser() { $user = Yii::app()->user; if ($user->isGuest) { return false; } if ($user->getState("role") === "admin") { return true; } $ich = Person::model()->findByAttributes(array("auth" => $user->id)); /** @var Person $ich */ if ($ich == null) { return false; } return $this->isAdmin($ich); }
/** * Displays a particular model. * @param integer $id the ID of the model to be displayed */ public function actionView($id) { $model = $this->loadModel($id); $itemsmodel = array(); $person = Person::model()->findAll("idPreuniGroup = " . $model->SpecialityID); foreach ($person as $pitem) { $sp = Statementpersons::model()->find("PersonID = {$pitem->idPerson} and StatementID = {$model->idStatement}"); if (empty($sp)) { $sp = new Statementpersons(); $sp->PersonID = $pitem->idPerson; $sp->StatementID = $model->idStatement; $sp->isNewRecord = false; } $itemsmodel[] = $sp; } $this->render('view', array('model' => $this->loadModel($id), "itemsmodel" => $itemsmodel)); }
/** * Displays a particular model. * @param integer $id the ID of the model to be displayed */ public function actionView($id = NULL, $action = NULL) { if (NULL === $id) { $id = Yii::app()->user->id; } $user_model = Users::model()->loadModel($id); $person_model = Person::model()->loadModel($id); $this->resource = Users::USER_RESOURCE_PREFIX . $user_model->user_level; if (!Users::isMyAccount($id)) { $this->hasPrivilege(); } $this->pageTitle = $person_model->name; $this->showPageTitle = TRUE; $address_model = PersonAddress::model()->find('`person_id`=:t1', array(':t1' => $id)); if (NULL === $address_model) { $address_model = new PersonAddress(); $address_model->person_id = $id; } if (!empty($action)) { if (!Users::isMyAccount($id)) { $this->checkPrivilege($user_model, Acl::ACTION_UPDATE); } switch ($action) { case Users::ACTION_UPDATE_PERSONAL: $this->update($person_model); break; case Users::ACTION_UPDATE_ACCOUNT: $this->update($user_model); break; case Users::ACTION_UPDATE_ADDRESS: $this->update($address_model); break; case Users::ACTION_RESET_PASSWORD: $this->resetPassword($user_model); break; case Users::ACTION_CHANGE_PASSWORD: $this->changePassword($user_model); break; default: $action = NULL; } } $this->render('view', array('user_model' => $user_model, 'person_model' => $person_model, 'address_model' => $address_model, 'action' => $action)); }
/** * @return bool */ public function istSichtbarCurrUser() { if ($this->status == static::$STATUS_GELOESCHT) { return false; } if ($this->status == static::$STATUS_FREI) { return true; } if ($this->getVeranstaltung()->isAdminCurUser()) { return true; } $user = Yii::app()->user; if ($user->isGuest) { return false; } /** @var Person $ich */ $ich = Person::model()->findByAttributes(array("auth" => $user->id)); return $ich->id == $this->verfasserIn_id; }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $id = Yii::app()->user->id; $user_model = Users::model()->loadModel($id); $person_model = Person::model()->loadModel($id); $address_model = PersonAddress::model()->find('`person_id`=:t1', array(':t1' => $id)); if (NULL === $address_model) { $address_model = new PersonAddress(); $address_model->person_id = $id; } $models = self::kinsOrNominees(); //$this->performAjaxValidation($model); if (isset($_POST['KinsAndNominees'])) { foreach ($models as $m => $model) { $models[$m]->attributes = $_POST['KinsAndNominees'][$model->dependent_member]; KinsAndNominees::model()->modelSave($models[$m]); } } $this->render('application.modules.users.views.default.view', array('user_model' => $user_model, 'person_model' => $person_model, 'address_model' => $address_model, 'models' => $models, 'jamaa' => Person::model()->findByPk($_REQUEST['id']), 'child' => DependentMembers::model()->dependents($id, 5) || DependentMembers::model()->dependents($id, 10), 'spouse' => DependentMembers::model()->dependents($id, 4) || DependentMembers::model()->dependents($id, 9), 'prnts' => DependentMembers::model()->dependents($id, 1) || DependentMembers::model()->dependents($id, 6), 'inlaws' => DependentMembers::model()->dependents($id, 2) || DependentMembers::model()->dependents($id, 7), 'siblings' => DependentMembers::model()->dependents($id, 3) || DependentMembers::model()->dependents($id, 8), 'action' => $_REQUEST['kiNom'] == 'kin' ? KinsAndNominees::NEXT_OF_KIN : KinsAndNominees::NOMINEE, 'render' => 'application.views.kinsAndNominees.create')); }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new Tournament(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Tournament'])) { $model->attributes = $_POST['Tournament']; $person = Person::model()->findAll(); foreach ($person as $p) { $t[] = $p['id']; } //arra if ($model->save()) { for ($i = 0; $i < $model->count; $i++) { $battle = new Battle(); } $this->redirect(array('view', 'id' => $model->id)); } } $this->render('create', array('model' => $model)); }
protected function getSubmitPerson($andereAntragstellerInErlaubt) { if (Yii::app()->user->isGuest) { $antragstellerIn = null; } elseif ($andereAntragstellerInErlaubt && isset($_REQUEST["andere_antragstellerIn"])) { $antragstellerIn = null; } else { /** @var Person $antragstellerIn */ $antragstellerIn = Person::model()->findByAttributes(array("auth" => Yii::app()->user->id)); if ($antragstellerIn) { $name_aenderung = isset($_REQUEST["Person"]["name"]) && $antragstellerIn->name !== $_REQUEST["Person"]["name"]; $orga_aenderung = isset($_REQUEST["Person"]["organisation"]) && $antragstellerIn->organisation !== $_REQUEST["Person"]["organisation"]; if ($name_aenderung || $orga_aenderung) { $antragstellerIn->name = $_REQUEST["Person"]["name"]; if (isset($_REQUEST["Person"]["organisation"])) { $antragstellerIn->organisation = $_REQUEST["Person"]["organisation"]; } $antragstellerIn->save(); } } } if (isset($_REQUEST["Person"])) { if ($antragstellerIn === null) { $antragstellerIn = new Person(); $antragstellerIn->attributes = $_REQUEST["Person"]; $antragstellerIn->telefon = isset($_REQUEST["Person"]["telefon"]) ? $_REQUEST["Person"]["telefon"] : ""; $antragstellerIn->typ = isset($_REQUEST["Person"]["typ"]) && $_REQUEST["Person"]["typ"] == "organisation" ? Person::$TYP_ORGANISATION : Person::$TYP_PERSON; $antragstellerIn->angelegt_datum = new CDbExpression('NOW()'); $antragstellerIn->status = Person::$STATUS_UNCONFIRMED; $antragstellerIn->save(); } else { if (!$antragstellerIn->telefon && isset($_REQUEST["Person"]["telefon"]) && $_REQUEST["Person"]["telefon"] != "") { $antragstellerIn->telefon = $_REQUEST["Person"]["telefon"]; $antragstellerIn->save(); } } } return $antragstellerIn; }
public function run($args) { if (count($args) != 2) { echo "Aufruf: ./yiic setze_passwort [Wurzelwerk-BenutzerInnenname|E-Mail] [NeuesPasswort]\n"; return; } if (strpos($args[0], "@")) { $auth = "email:" . $args[0]; } else { $auth = "openid:https://service.gruene.de/openid/" . $args[0]; } /** @var Person $person */ $person = Person::model()->findByAttributes(array("auth" => $auth)); if (!$person) { echo "Person nicht gefunden.\n"; return; } $person->pwd_enc = Person::create_hash($args[1]); if ($person->save()) { echo "Passwort erfolgreich gesetzt.\n"; } else { echo "Fehler beim Speichern.\n"; } }
public static function getFullNameListByUserID($user_id) { $company = null; $currentPerson = Person::model()->findByAttributes(array('user_id' => $user_id)); if (!empty($currentPerson)) { $company = $currentPerson->company_id; } if (!empty($company)) { $data = self::model()->findAllByAttributes(array('company_id' => $company)); $result = array(); if (!empty($data)) { foreach ($data as $record) { $result[$record->id] = $record->last_name . " " . $record->first_name . " " . $record->middle_name; } } return $result; } else { $result = array(); $result[0] = "За Вашим пользователем не закреплён сотрудник"; return $result; } }
<div class="form"> <?php $form = $this->beginWidget('CActiveForm', array('id' => 'cash-withdrawals-form', 'enableAjaxValidation' => true)); $member = Person::model()->findByPk($model->member); $name = "{$member->last_name} {$member->first_name} {$member->middle_name} - {$member->membershipno}"; $readOnly = isset($readOnly) ? $readOnly : $model->member != $user->primaryKey || $model->received_by_secretary != CashWithdrawals::PENDING || $model->approved_by_chairman != CashWithdrawals::PENDING || $model->effected_by_treasurer != CashWithdrawals::PENDING || !empty($model->secretary_date) || !empty($model->chairman_date) || !empty($model->treasurer_date) ? true : false; $officio = Maofficio::model()->officio(); ?> <?php if (!isset($_REQUEST['id'])) { ?> <div class="panel panel-default"> <div class="panel-heading"><h3 class="panel-title">Savings Withdrawal</h3></div> <div class="panel-body"> <div class="col-md-8 col-sm-12" style="width: 100%"> <div id="fomu" style="width: 100%"> <?php } ?> <table style="width: 100%"> <tr> <td><?php echo $form->labelEx($model, 'member'); ?> </td> <td colspan="2"><?php echo CHtml::textField('name', $name, array('size' => strlen($name) + 4, 'readonly' => true, 'style' => 'text-align:center')); ?>
public function getRegisterBalanceReport($person = null) { $rsltObject = new stdClass(); $personid = Yii::app()->user->person->id; $loginid = Yii::app()->user->login->id; $roleid = Yii::app()->user->role->id; $date = null; if(!empty($person)) { $personid = (!empty($person->id)?$person->id:-1); $date = $person->selected_date; if(!empty($date)) { $date = Yii::app()->controller->getMysqlFormattedDatetime($date); } $criteria=new CDbCriteria; $criteria->order = 't.id ASC'; $criteria->with = array('roles'=> array('together'=>true)); $criteria->limit = '1'; $condition = "t.id = " . $personid; $condition .= " AND LCASE(roles.role) = '" . strtolower(Helper::CONST_Sales) . "'"; $criteria->addCondition($condition); $result = Person::model()->findAll($criteria); foreach($result as $row) { $loginid = $row->personcompanyroles[0]->login_id; $roleid = $row->personcompanyroles[0]->role_id; break; } } $this->salesIncludesRefundCancel($rsltObject, $personid, $date); $this->totalRefunds($rsltObject, $personid, $date); $this->totalCancels($rsltObject, $personid, $date); $rsltObject->salesexclrfndcncl = $rsltObject->salesinclrfndcncl + $rsltObject->totalrefunds + $rsltObject->totalcancels; $rsltObject->salesafterdisc = $rsltObject->salesexclrfndcncl - $rsltObject->totaldisc; $rsltObject->salesafterroundoff = $rsltObject->salesafterdisc + $rsltObject->netroundoff; $rsltObject->saleswithtax = $rsltObject->salesafterroundoff + $rsltObject->totaltax; $this->paymentTypewiseSummary($rsltObject, $personid, $loginid, $roleid, $date); return $rsltObject; }
<?php $this->pageTitle = Yii::app()->name . ' - ' . Yii::t('ui', 'Select2'); $this->layout = 'leftbar'; $this->leftPortlets['application.portlets.ExtensionMenu'] = array(); // Set demo value $model = Person::model()->findbyPk(2400); $model->countryIds = array(1, 2, 3); $model->personIds = '1,2,3'; ?> <h2><?php echo Yii::t('ui', 'Select2'); ?> </h2> <h3>Select single</h3> <p>wrapper for dropdown</p> <?php $this->widget('ext.widgets.select2.XSelect2', array('model' => $model, 'attribute' => 'country_id', 'data' => Country::model()->options, 'htmlOptions' => array('style' => 'width:300px'))); ?> <div class="tpanel"> <div class="toggle"><?php echo Yii::t('ui', 'View code'); ?> </div> <?php $this->beginWidget('CTextHighlighter', array('language' => 'PHP')); ?> $this->widget('ext.widgets.select2.XSelect2', array(
<?php $form_id = 'person-address-form'; $form = $this->beginWidget('CActiveForm', array('id' => $form_id, 'enableAjaxValidation' => false, 'htmlOptions' => array('class' => 'form-horizontal', 'role' => 'form'))); $person_model = Person::model()->findByPk($model->person_id); ?> <div class="panel panel-default"> <div class="panel-heading"><h3 class="panel-title"><?php echo Lang::t('Update Address Information'); ?> </h3></div> <div class="panel-body"> <div class="row"> <div class="col-md-8 col-sm-12"> <?php $this->renderPartial('application.views.person._address_fields', array('model' => $model, 'label_size' => 3, 'input_size' => 8)); ?> </div> </div> </div> <div class="panel-footer clearfix"> <button class="btn btn-sm btn-primary" type="submit"><i class="icon-ok bigger-110"></i> <?php echo Lang::t('Save changes'); ?> </button> <a class="btn btn-sm" href="<?php echo Controller::getReturnUrl($this->createUrl('view', array('id' => $model->person_id))); ?> "><i class="icon-remove bigger-110"></i><?php echo Lang::t('Close');
public function actionDeleteDataSources() { if (!empty($_POST['source'])) { foreach ($_POST['source'] as $source_id) { if (Institution::model()->find('source_id=?', array($source_id))) { echo "0"; return; } if (Site::model()->find('source_id=?', array($source_id))) { echo "0"; return; } if (Person::model()->find('source_id=?', array($source_id))) { echo "0"; return; } } foreach ($_POST['source'] as $source_id) { if ($source = ImportSource::model()->findByPk($source_id)) { if (!$source->delete()) { throw new Exception("Unable to delete import source: " . print_r($source->getErrors(), true)); } } } Audit::add('admin-DataSource', 'delete'); } echo "1"; }
public function beforeDelete() { Person::model()->loadModel($this->id)->delete(); return parent::beforeDelete(); }
/** * send to user new password * @return type */ public function actionResetPersonPassword($ccmp_id, $person_id) { //only for validation acces $model = $this->loadModel($ccmp_id); yii::import('vendor.dbrisinajumi.person.PersonModule'); //if do not have user, create $m = Person::model(); $m->resetPassword($person_id); $this->redirect(array('adminCustomers', 'ccmp_id' => $ccmp_id)); }
<?php $name = Person::model()->get($model->contact_person_id, 'CONCAT(first_name," ",last_name)'); $email = Users::model()->get($model->contact_person_id, 'email'); $phone = PersonAddress::model()->getScaler('phone1', '`person_id`=:t1', array(':t1' => $model->contact_person_id)); ?> <div class="panel-group" id="accordion1"> <div class="panel panel-default"> <div class="panel-heading"> <h4 class="panel-title"> <i class="fa fa-chevron-down"></i> <a data-toggle="collapse" data-parent="#accordion1" href="#store_contact_person"><?php echo Lang::t('Contact Person'); ?> </a> <?php if (!empty($model->contact_person_id) && $this->showLink(UserResources::RES_USER_ADMIN)) { ?> <span><a class="pull-right" href="<?php echo Yii::app()->createUrl('users/default/view', array('id' => $model->contact_person_id)); ?> "><?php echo Lang::t('View full profile'); ?> <i class="fa fa-external-link"></i></a></span> <?php } ?> </h4> </div> <div id="store_contact_person" class="panel-collapse collapse in"> <div class="panel-body">
</td> </tr> <tr><td> </td></tr> <tr> <td><?php echo $form->labelEx($model, 'guarantor2'); ?> </td> <td> </td> <td> <?php if ($others['readOnly'] == true) { ?> <?php $person = Person::model()->findByPk($model->guarantor2); if (!empty($person)) { echo $form->textField($model, 'guarantor2', array('value' => "{$person->last_name} {$person->first_name} {$person->middle_name}", 'style' => 'text-align:center', 'readonly' => $others['readOnly'])); } ?> <?php } else { ?> <?php $bandu = $this->otherGaranta($model->member, $model->witness, $model->guarantor1); echo $form->dropDownList($model, 'guarantor2', $bandu); ?> <?php } ?> </td>
/** * Lists all models. */ public function actionRefresh($id) { $person = Person::model()->findByPk($id); $this->renderPartial("//person/tabs/_benefits", array('models' => $person->benefits, "personid" => $id)); }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id) { $model = Person::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
/** * Ajax action to get cc contact details. * * @throws Exception */ public function actionGetCc() { if (!($patient = Patient::model()->findByPk(@$_GET['patient_id']))) { throw new Exception('Unknown patient: ' . @$_GET['patient_id']); } if (!preg_match('/^([a-zA-Z]+)([0-9]+)$/', @$_GET['contact'], $m)) { throw new Exception('Invalid contact format: ' . @$_GET['contact']); } if ($m[1] == 'Contact') { $contact = Person::model()->find('contact_id=?', array($m[2])); } else { if (!($contact = $m[1]::model()->findByPk($m[2]))) { throw new Exception("{$m[1]} not found: {$m[2]}"); } } if ($contact->isDeceased()) { echo json_encode(array('errors' => 'DECEASED')); return; } $address = $contact->getLetterAddress(array('patient' => $patient, 'include_name' => true, 'include_label' => true, 'delimiter' => '| ', 'include_prefix' => true)); $address = str_replace(',', ';', $address); $address = str_replace('|', ',', $address); echo $address ? $address : 'NO ADDRESS'; }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. */ public function loadModel() { if ($this->_model === null) { if (isset($_GET['id'])) { $this->_model = Person::model()->findbyPk($_GET['id']); } if ($this->_model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } } return $this->_model; }