public static function sendEmail($scenario, $userId = "", $messageId = "", $tempPassword = "", $cc = "", $bcc = "") { $model = EmailTemplateApi::getTemplateByScenario($scenario); if ($userId) { $user = UserApi::getUser($userId); } if ($user) { $data["verification_link"] = SecurityUtils::getVerificationLink($user["activation_code"]); $data["email_id"] = $user["email_id"]; $data["name"] = UserApi::getNameByUserId($userId); } if ($tempPassword) { $data["temp_password"] = $tempPassword; } if ($messageId) { $message = PmbApi::loadMessage($messageId); } if ($message) { $data["message_subject"] = $message->subject; $data["message_content"] = $message->content; $data["message_from"] = UserApi::getNameByUserId($message->from_user_id); } if ($model) { $htmlEmail = self::changeTemplate($data, $model->body_html); $plainEmail = self::changeTemplate($data, $model->body_plain); $emailData["from_email"] = $model->from_email; $emailData["from_name"] = $model->from_name; $emailData["subject"] = $model->subject; $emailData["body_html"] = $htmlEmail; $emailData["body_plain"] = $plainEmail; return EmailQueueApi::addToQueue($user["email_id"], $cc, $bcc, "", $emailData); } return false; }
public function actionReply($userId) { Yii::beginProfile('messageReply'); $pmbMessage = new PmbMessages(); $user = UserApi::getUser($userId); if (!$user) { throw new CHttpException(404, 'The requested page does not exist.'); } $pmbMessage->to_user_id = $userId; $pmbMessage->from_user_id = Yii::app()->user->id; $userName = UserApi::getNameByUserId($userId); if (isset($_POST['submit'])) { $pmbMessage->attributes = $_POST['PmbMessages']; if ($pmbMessage->save()) { $data = array(); $user = UserApi::getUserById($pmbMessage->to_user_id); $user ? $data["user"] = $user->id : null; $data["message"] = $pmbMessage->id; EmailApi::sendEmail($user->email_id, "ACTIVITY.MESSAGE.NEW", $data); $this->redirect('/messages/sent'); } } $this->render('reply', array('pmbMessage' => $pmbMessage, 'user' => $user, 'userName' => $userName)); Yii::endProfile('messageReply'); }
<div class="view"> <b><?php echo CHtml::encode($data->getAttributeLabel('user_id')); ?> :</b> <?php echo CHtml::link(CHtml::encode(UserApi::getNameByUserId($data->user_id)), array('/store/user/view', 'id' => $data->user_id)); ?> <br /> <b><?php echo CHtml::encode($data->getAttributeLabel('question')); ?> :</b> <?php echo CHtml::encode($data->question); ?> <br /> <b><?php echo CHtml::encode($data->getAttributeLabel('description')); ?> :</b> <?php echo CHtml::encode($data->description); ?> <br />
<?php $this->breadcrumbs = array('User Specialist Projects' => array('index'), 'View'); $this->menu = array(array('label' => 'List UserSpecialistProjects', 'url' => array('index')), array('label' => 'Create UserSpecialistProjects', 'url' => array('create')), array('label' => 'Update UserSpecialistProjects', 'url' => array('update', 'id' => $model->id)), array('label' => 'Delete UserSpecialistProjects', 'url' => '#', 'linkOptions' => array('submit' => array('delete', 'id' => $model->id), 'confirm' => 'Are you sure you want to delete this item?')), array('label' => 'Manage UserSpecialistProjects', 'url' => array('admin'))); ?> <h1>View UserSpecialistProjects</h1> <?php $this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array('id', array('name' => 'user_id', 'value' => UserApi::getNameByUserId($model->user_id)), array('name' => 'specialist_type_id', 'value' => SpecializationsApi::getSpecializationById($model->specialist_type_id)), 'project_name', 'description', 'image', 'duration', 'updated_time', 'updated_by', 'created_time', 'created_by')));
<?php $this->breadcrumbs = array('User Builder Profiles' => array('index'), $model->id); $this->menu = array(array('label' => 'List UserBuilderProfile', 'url' => array('index')), array('label' => 'Create UserBuilderProfile', 'url' => array('create')), array('label' => 'Update UserBuilderProfile', 'url' => array('update', 'id' => $model->id)), array('label' => 'Delete UserBuilderProfile', 'url' => '#', 'linkOptions' => array('submit' => array('delete', 'id' => $model->id), 'confirm' => 'Are you sure you want to delete this item?')), array('label' => 'Manage UserBuilderProfile', 'url' => array('admin'))); ?> <h1>View UserBuilderProfile #<?php echo $model->id; ?> </h1> <?php $this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array('id', array('name' => 'user_id', 'value' => UserApi::getNameByUserId($model->user_id)), 'company_name', 'company_description', 'address_line1', 'address_line2', 'country_id', 'state_id', 'city_id', 'mobile', 'telephone', 'email', 'image')));
<?php $this->breadcrumbs = array('Properties' => array('index'), 'View'); $this->menu = array(array('label' => 'List Property', 'url' => array('index')), array('label' => 'Create Property', 'url' => array('create')), array('label' => 'Update Property', 'url' => array('update', 'id' => $model->id)), array('label' => 'Delete Property', 'url' => '#', 'linkOptions' => array('submit' => array('delete', 'id' => $model->id), 'confirm' => 'Are you sure you want to delete this item?')), array('label' => 'Manage Property', 'url' => array('admin'))); if ($model->projectProperties) { $this->menu[] = array('label' => 'Back to Project', 'url' => Yii::app()->request->urlReferrer); } ?> <h1>View Property</h1> <?php $this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array('id', array('label' => 'User Name', 'type' => 'raw', 'value' => CHtml::link(CHtml::encode(UserApi::getNameByUserId($model->user_id)), array('/store/user/view', 'id' => $model->user_id))), 'i_want_to', 'property_name', 'description', 'features', 'featured', 'jackpot_investment', 'instant_home', 'propertyType.property_type', 'transactionType.transaction_type', 'locality.locality', 'address', 'bathrooms', 'bedrooms', 'furnished', 'age_of_construction', 'ownershipType.ownership_type', 'covered_area', 'land_area', 'total_price', 'per_unit_price', 'area_type', 'display_price', 'price_negotiable', 'available_from', 'available_units', 'facing', 'floor_number', 'total_floors', 'landmarks', 'tax_fees', 'terms_and_conditions'))); $images = PropertyImagesApi::getAllImages($model->id); $propertyAmenities = $model->propertyAmenities; $amenities = null; foreach ($propertyAmenities as $i => $propertyAmenity) { if ($i != 0) { $amenities .= ", "; } $amenities .= $propertyAmenity->amenity->amenity; } ?> <table id="yw0" class="detail-view"> <tbody> <tr class="even"> <th>Average Rating</th> <td><?php echo PropertyRatingApi::getRating($model->id); ?> </td>
<div class="view"> <b><?php echo CHtml::encode($data->getAttributeLabel('user_id')); ?> :</b> <?php echo UserApi::getNameByUserId($data->user_id); ?> <br /> <b><?php echo CHtml::encode($data->getAttributeLabel('i_want_to')); ?> :</b> <?php echo CHtml::encode($data->i_want_to); ?> <br /> <b><?php echo CHtml::encode($data->getAttributeLabel('description')); ?> :</b> <?php echo CHtml::encode($data->description); ?> <br /> <b><?php
<?php $this->breadcrumbs = array('Jukebox Questions' => array('index'), 'View'); $this->menu = array(array('label' => 'List JukeboxQuestions', 'url' => array('index')), array('label' => 'Create JukeboxQuestions', 'url' => array('create')), array('label' => 'Update JukeboxQuestions', 'url' => array('update', 'id' => $model->id)), array('label' => 'Delete JukeboxQuestions', 'url' => '#', 'linkOptions' => array('submit' => array('delete', 'id' => $model->id), 'confirm' => 'Are you sure you want to delete this item?')), array('label' => 'Manage JukeboxQuestions', 'url' => array('admin'))); ?> <h1>View JukeboxQuestions</h1> <?php $this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array('id', array('label' => 'User Name', 'type' => 'raw', 'value' => CHtml::link(CHtml::encode(UserApi::getNameByUserId($model->user_id)), array('/store/user/view', 'id' => $model->user_id))), 'question', 'description', 'category.category')));
public static function sendEmail($to, $scenario, $data = "", $cc = "", $bcc = "") { $model = EmailTemplateApi::getTemplateByScenario($scenario); $template = array(); if ($model) { $template["home_link"] = Yii::app()->createAbsoluteUrl('/'); $template["signin_link"] = Yii::app()->createAbsoluteUrl('/account'); $template["logo_link"] = Yii::app()->createAbsoluteUrl('/') . Yii::app()->theme->baseUrl . '/images/logo-newsletter.jpg'; if ($data) { if (is_array($data)) { foreach ($data as $key => $value) { if ($key == "user") { $user = UserApi::getUser($value); if ($user) { $template["verification_link"] = SecurityUtils::getVerificationLink($user["activation_code"], $user["email_id"]); $template["email_id"] = $user["email_id"]; $template["name"] = UserApi::getNameByUserId($value); } continue; } else { if ($key == "temp_password") { $template["temp_password"] = $value; continue; } else { if ($key == "message") { $message = PmbApi::loadMessage($value); if ($message) { $template["message_subject"] = $message->subject; $template["message_content"] = $message->content; $template["message_body"] = $message->content; $template["message_from"] = UserApi::getNameByUserId($message->from_user_id); } continue; } else { if ($key == "feedback") { $user = UserApi::getUserById($value); $feedback = FeedbackApi::getLatestFeedback($toId, $entityId, $type); if ($user) { $template["first_name"] = $user->first_name; $template["feedback"] = $feedback->feedback; $template["specialist_rating"] = SpecialistRatingApi::getRating($specialist->user_id); } continue; } } } } } } } $htmlEmail = self::changeTemplate($template, $model->body_html); $plainEmail = self::changeTemplate($template, $model->body_plain); $emailData["from_email"] = $model->from_email; $emailData["from_name"] = $model->from_name; $emailData["subject"] = self::changeTemplate($template, $model->subject); $emailData["body_html"] = $htmlEmail; $emailData["body_plain"] = $plainEmail; return EmailQueueApi::addToQueue($to, $cc, $bcc, "", $emailData); } return false; }
<?php $this->breadcrumbs = array('Projects' => array('index'), 'View'); $this->menu = array(array('label' => 'List Projects', 'url' => array('index')), array('label' => 'Create Projects', 'url' => array('create')), array('label' => 'Update Projects', 'url' => array('update', 'id' => $model->id)), array('label' => 'Delete Projects', 'url' => '#', 'linkOptions' => array('submit' => array('delete', 'id' => $model->id), 'confirm' => 'Are you sure you want to delete this item?')), array('label' => 'Manage Projects', 'url' => array('admin'))); ?> <h1>View Projects</h1> <?php $this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array('id', array('label' => 'User Name', 'type' => 'raw', 'value' => CHtml::link(CHtml::encode(UserApi::getNameByUserId($model->user_id)), array('/store/user/view', 'id' => $model->user_id))), 'project_name', 'description', 'projectType.project_type', 'ownershipType.ownership_type', 'locality.locality', 'address', 'features', 'covered_area', 'land_area', 'total_price', 'price_starting_from', 'per_unit_price', 'area_type', 'display_price', 'price_negotiable', 'landmarks', 'tax_fees', 'terms_and_conditions', 'views', 'recently_viewed'))); $images = ProjectImagesApi::getAllImages($model->id); $projectImages = ProjectImagesApi::getAll($model->id); $projectAmenities = $model->projectAmenities; $amenities = null; foreach ($projectAmenities as $i => $projectAmenity) { if ($i != 0) { $amenities .= ", "; } $amenities .= $projectAmenity->amenity->amenity; } ?> <table id="yw0" class="detail-view"> <tbody> <tr class="even"> <th>Amenities</th> <td><?php echo $amenities; ?> </td> </tr> </tbody> </table>
public function actionView($id) { Yii::beginProfile('view_profile'); //$session = Yii::app()->session; $wheelsImages = array(); $wheelImages = array(); $lastRide = array(); $user = UserApi::getUserById($id); if (!$user) { throw new CHttpException(404, 'The requested page does not exist.'); } $userAge = UserApi::getAge($user->dob); $userAddress = ""; if ($user->city_id) { $userAddress = DbUtils::getAddress($user->city_id); } $imageUserId = array($id); $image = ImagesApi::getPrimaryImageForUsers($imageUserId); if ($image) { $userImage = $image[$id]; } else { $userImage = ImageUtils::getDefaultImage('user'); } $userWheelDefault = ImageUtils::getDefaultImage('wheel'); $userRides = RidesApi::getCountOfUserRides($id); $userEcoMiles = RidesApi::getEcoMilesDrivenByUser($id); $userWheel = WheelApi::getWheelsCount($id); $userPalsCount = UserPalsApi::getPalsCount($id); $entityId = EntityApi::getIdByType("user"); $driverRating = round(FeedbackApi::getRating($id, $entityId, 'DRIVER')); $passengerRating = round(FeedbackApi::getRating($id, $entityId, 'PASSENGER')); $userPals = UserPalsApi::getAllPals($id); $userPalDefaultImage = ImageUtils::getDefaultImage('user'); $lastRide = RidesApi::getLastRide($id); $lastRideWheel = WheelApi::getWheelById($lastRide[0]['wheel_id']); $userWheels = WheelApi::getWheelsByUserId($id); $favoriteWheel = WheelApi::getFavouriteWheel($id); $userFeedback = FeedbackApi::getAllFeedback($id, $entityId); $favWheelDetail = ""; $wheelMake = ""; $wheelModel = ""; $wheelColor = ""; $wheelRides = ""; $wheelEcoMiles = ""; $wheelPals = ""; $wheelPalCnt = ""; if ($favoriteWheel) { $favWheelDetail = WheelApi::getWheelById($favoriteWheel[0]["wheel_id"]); $wheelMake = MakeApi::getMakeById($favWheelDetail->make_id); $wheelModel = ModelApi::getModelById($favWheelDetail->model_id); $wheelColor = ColorApi::getColorById($favWheelDetail->color_id); $wheelRides = RidesApi::getCountOfWheelRides($favWheelDetail->id); $wheelImage = ImagesApi::getPrimaryImageForWheels(array($favoriteWheel[0]["wheel_id"])); if (!$wheelImage) { $wheelImage = $userWheelDefault; } $wheelEcoMiles = RidesApi::getEcoMilesDrivenByWheel($favWheelDetail->id); $wheelPals = WheelApi::getNoOfPalsMetByWheelId($favWheelDetail->id); $wheelPalCnt = $wheelPals[0]['palcnt']; } $i = 0; if ($userFeedback) { foreach ($userFeedback as $feedback) { $fromUserProfile = UserApi::getUserById($feedback->from_user_id); $fromUserIds[$i] = $feedback->from_user_id; $userName = UserApi::getNameByUserId($fromUserProfile->id); $userFeedbackDetails[$i++] = array('from_id' => $feedback->from_user_id, 'userName' => $userName, 'feedback' => $feedback->feedback); } } $i = 0; $j = 0; $userPalList = ""; $palScrollLabel = ""; $mergeArray = array_merge($userPals, $fromUserIds); $userIdList = array_unique($mergeArray); $userImages = ImagesApi::getPrimaryImageForUsers($userIdList); $imageArrayIndex = array_keys($userImages); $imageArrayIndexSize = count($imageArrayIndex); //var_dump($userPals); // var_dump($fromUserIds);die(); if ($userPals) { foreach ($userPals as $userPal) { $userPalList[$i++] = userapi::getUserById($userPal); } } if ($userIdList) { foreach ($userIdList as $userId) { for ($j = 0; $j < $imageArrayIndexSize; $j++) { $palsImages[$userId] = ''; if ($imageArrayIndex[$j] == $userId) { $palsImages[$userId] = $userImages[$userId]; break; } } if ($palsImages[$userId] == '') { $palsImages[$userId] = $userPalDefaultImage; } } } if ($userWheels) { foreach ($userWheels as $wheel) { $wheelIds[$wheel->id] = $wheel->id; } if ($wheelIds) { $wheelImages = ImagesApi::getPrimaryImageForWheels($wheelIds); if ($wheelImages) { $imageArrayIndex = array_keys($wheelImages); $imageArrayIndexSize = count($imageArrayIndex); foreach ($wheelIds as $wheelId) { for ($j = 0; $j < $imageArrayIndexSize; $j++) { $wheelsImages[$wheelId] = ''; if ($imageArrayIndex[$j] == $wheelId) { $wheelsImages[$wheelId] = $wheelImages[$wheelId]; break; } } if ($wheelsImages[$wheelId] == '') { $wheelsImages[$wheelId] = $userWheelDefault; } } } } } /*$palCntArray=ceil($userPalsCount/3); $l=0; if($userPalsCount>2){ for($i=0;$i<$palCntArray-1;$i++){ $palScroll[$i]=array($userPalList[$l],$userPalList[$l+1],$userPalList[$l+2]); $l=$l+3; } } while($l<$userPalsCount) { $palScroll[$palCntArray-1]=array($userPalList[$l]); $l++; } $palScrollLabel=$palScroll[0]; } $k=1; if (isset($_POST['ajxbtn'])){ if($k < $palCntArray) $palScrollLabel=$palScroll[$k]; $k++; } */ $this->render('view', array('user' => $user, 'userAddress' => $userAddress, 'userPalsCount' => $userPalsCount, 'userAge' => $userAge, 'userImage' => $userImage, 'userEcoMiles' => $userEcoMiles, 'userPals' => $userPals, 'userRides' => $userRides, 'userWheel' => $userWheel, 'driverRating' => $driverRating, 'passengerRating' => $passengerRating, 'userPalList' => $userPalList, 'favWheelDetail' => $favWheelDetail, 'wheelMake' => $wheelMake, 'wheelColor' => $wheelColor, 'wheelModel' => $wheelModel, 'wheelRides' => $wheelRides, 'wheelEcoMiles' => $wheelEcoMiles, 'wheelPalCnt' => $wheelPalCnt, 'palScrolls' => $palScrollLabel, 'palImages' => $palsImages, 'userFeedbackDetails' => $userFeedbackDetails, 'wheelsImages' => $wheelsImages, 'userWheels' => $userWheels, 'wheelImage' => $wheelImage, 'lastRide' => $lastRide, 'lastRideWheel' => $lastRideWheel)); Yii::endProfile('view_profile'); }
<?php $this->breadcrumbs = array('Requirements' => array('index'), 'View'); $this->menu = array(array('label' => 'List Requirement', 'url' => array('index')), array('label' => 'Create Requirement', 'url' => array('create')), array('label' => 'Update Requirement', 'url' => array('update', 'id' => $model->id)), array('label' => 'Delete Requirement', 'url' => '#', 'linkOptions' => array('submit' => array('delete', 'id' => $model->id), 'confirm' => 'Are you sure you want to delete this item?')), array('label' => 'Manage Requirement', 'url' => array('admin'))); ?> <h1>View Requirement</h1> <?php $this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array(array('name' => 'user_id', 'value' => UserApi::getNameByUserId($model->user_id)), 'i_want_to', 'description', 'covered_area_from', 'covered_area_to', 'plot_area_from', 'plot_area_to', 'min_price', 'max_price')));
?> <a href="/messages/sent" class="blu_bg_lnk">Sent Items</a> <?php } ?> </div> <h1 class="heading" id="heading">My Message</h1> <div class="inner-column"> <?php $this->widget('MyAccountMenu', array('page' => 'messages')); $name = ""; if ($message->from_user_id == Yii::app()->user->id) { $name = "<a href='/profile/" . $message->from_user_id . "'>You</a> To <a href='/profile/" . $message->to_user_id . "'>" . ucwords(UserApi::getNameByUserId($message->to_user_id)) . "</a> "; } elseif ($message->to_user_id == Yii::app()->user->id) { $name = "<a href='/profile/" . $message->from_user_id . "'>" . ucwords(UserApi::getNameByUserId($message->from_user_id)) . "</a> To <a href='/profile/" . $message->to_user_id . "'>You</a> "; } echo '<div class="right cols2"> <div id="property_search_results"> <h1 class="property_search_results_top">' . $name . '<span class="right new">' . date("d M,Y H:i:s", strtotime($message->created_time)) . '</span> </h1>'; echo '<div class="message_view">'; echo '<h3><span>Subject :: </span>' . $message->subject . '</h3>'; echo '<p>' . $message->content . '</p>'; echo '</div>'; echo '<div class="pad10">'; echo '<div class="left"><a href="#" class="red_bg_lnk">Delete</a></div>'; if ($message->from_user_id == Yii::app()->user->id) { echo '<div class="right">' . CHtml::link('Compose', '/message/reply/' . $message->to_user_id . '', array('class' => 'gry_bg_lnk')) . '</div>'; } elseif ($message->to_user_id == Yii::app()->user->id) { echo '<div class="right">' . CHtml::link('Reply', '/message/reply/' . $message->from_user_id . '', array('class' => 'gry_bg_lnk')) . '</div>'; }
<?php $this->breadcrumbs = array('Jukebox Answers' => array('index'), 'View'); $this->menu = array(array('label' => 'List JukeboxAnswers', 'url' => array('index')), array('label' => 'Create JukeboxAnswers', 'url' => array('create')), array('label' => 'Update JukeboxAnswers', 'url' => array('update', 'id' => $model->id)), array('label' => 'Delete JukeboxAnswers', 'url' => '#', 'linkOptions' => array('submit' => array('delete', 'id' => $model->id), 'confirm' => 'Are you sure you want to delete this item?')), array('label' => 'Manage JukeboxAnswers', 'url' => array('admin'))); ?> <h1>View JukeboxAnswers</h1> <?php $this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array('id', array('label' => 'User Name', 'type' => 'raw', 'value' => CHtml::link(CHtml::encode(UserApi::getNameByUserId($model->user_id)), array('/store/user/view', 'id' => $model->user_id))), 'jukeboxQuestion.question', 'answer', 'reference_url', 'status')));