public function __construct($url, $passwrod) { YII::import('application.modules.site.components.sharedkey_api.curl.ACurl'); $this->type = Yii::app()->params->serviceType; $this->host = $url; $this->password = $passwrod; }
public function actionSubmit() { $data = array('email' => YII::app()->request->getParam('email', null), 'name' => YII::app()->request->getParam('name', null), 'message' => YII::app()->request->getParam('message', null)); $model = new ContactusForm(); $model->setAttributes($data); $isValid = $model->validate(); $emails = array(Yii::app()->params['contactusEmail']); if (Yii::app()->user->isGuest) { if ($model->validate()) { $this->_send($model); //redirect Yii::app()->request->redirect(basePath('contactus/confirm')); } else { //render errors $this->layout = "main"; $this->render('guest', array('email' => $data['email'], 'name' => $data['name'], 'contact' => Yii::app()->params['contactusEmail'], 'message' => $data['message'], 'errors' => $model->getErrors())); } } else { $model->email = Yii::app()->user->getState('email'); if ($model->validate()) { $this->_send($model); //redirect Yii::app()->request->redirect(basePath('contactus/confirm')); } else { //render errors $this->layout = "app"; $this->render('user', array('email' => $data['email'], 'name' => $data['name'], 'contact' => Yii::app()->params['contactusEmail'], 'message' => $data['message'], 'errors' => $model->getErrors())); } } }
public function getPrincipalByPath($path) { $base = YII::app()->createUrl("termine/dav", ["termin_id" => $this->termin_id]); if ($path == 'principals/guest') { return ['{DAV:}displayname' => 'Gast', 'uri' => "principals/guest"]; } return null; }
public function update() { $id = YII::app()->user->getState('id'); $userApi = sharedkeyApi::create('usersAPI'); $userApi->addParams(array('id' => $id, 'format' => 'json')); $data = $userApi->byid('get'); $data = json_decode($data); $this->setData((array) $data); return true; }
/** * * * @param type $name * @param type $access * @param type $host * @return serviceApi */ static function create($name, $access = 'default') { $host = YII::app()->params->type; $names = explode('.', $name); $className = array_pop($names); $path = implode('.', $names); YII::import('application.modules.site.components.sharedkey_api.services' . $path . '.' . $className); $api = new $className(self::getHosts($host), self::getPassword($access)); return $api; }
public function actionEmail() { $data = $_GET; $data['email_confirm'] = isset($data['email']) ? $data['email'] : ''; $validator = new signUpModel(); $validator->setAttributes($data); $validator->validate(); $emailError = $validator->getError('email'); $valid = $emailError != null ? false : true; echo json_encode($valid); YII::app()->end(); }
public function actionDeleteActive() { if ($this->access > UserAccessTable::FULL_ACCESS) { return 0; } $data = array(); $data['property_id'] = Yii::app()->user->getState('property_id', 0); $data['id'] = YII::app()->request->getPost('id', 0); $api = sharedkeyApi::create('keycontactAPI'); $api->addParams($data); $result = $api->byContactId('delete'); $result = json_decode($result); $this->renderPartial('delete', array('result' => $result->result)); }
public function loadModel() { $model = null; if ($model == null) { if (isset($_POST['User']['userId'])) { $model = User::model()->findByPk($_POST['User']['userId']); } else { $model = User::model()->findByPk(YII::app()->user->userId); } if ($model === null) { throw new CHttpException(404, '您访问的用户不存在'); } } return $model; }
/** *上传多个key不同的文件这里头像解析就要注意了!字段名发生了变化 * @param $model * @param array $array 上传表单的attribute */ public function upload($model, $array = array()) { $files = array(); foreach ($array as $index => $attribute) { $attach = CUploadedFile::getInstance($model, $attribute); if ($attach) { if (isset(YII::app()->user->userId)) { $prefix = YII::app()->user->userId . time() . $index . '.'; } else { $prefix = md5(microtime()) . $index . '.'; } $imageName = $prefix . $attach->extensionName; $attach->saveAs($this->savePath . $imageName); $thumbName = $this->saveThumb($prefix, $attach->extensionName); $model->{$attribute} = CJSON::encode(array('origin' => $imageName, 'thumb' => $thumbName)); } } }
public function run() { echo '<div>'; if ($this->all_time) { echo 'Отработало за ' . sprintf('%0.5f', Yii::getLogger()->getExecutionTime()) . ' с. '; } if ($this->memory) { echo 'Скушано памяти: ' . round(memory_get_peak_usage() / (1024 * 1024), 2) . ' MB'; } echo '<br>'; $sql_stats = YII::app()->db->getStats(); if ($this->db_query) { echo $sql_stats[0] . ' запросов к БД. '; } if ($this->db_time) { echo 'время выполнения запросов - ' . sprintf('%0.5f', $sql_stats[1]) . ' c.'; } echo '</div>'; }
function __construct($topic_name, $identity, $host_name = "kafka") { $conf = YII::app()->params[$host_name]; if ($conf == '' || $topic_name == '' || $identity == '') { echo "error : no init param"; exit; } if (!in_array($identity, array('producer', 'consumer'))) { echo "error : wrong identity"; exit; } $this->topic_name = $topic_name; //初始化全局配置 $rd_conf = new RdKafka\Conf(); $rd_conf->set('metadata.broker.list', $conf['host']); #$rd_conf -> set('socket.keepalive.enable',true); #$rd_conf -> set('log_level',LOG_DEBUG);//Logging level (syslog(3) levels) //print_r($rd_conf->dump());exit; switch ($identity) { case 'producer': $rd_conf->set('compression.codec', 'none'); //Compression codec to use for compressing message sets: none, gzip or snappy;default none $this->producer = new RdKafka\Producer($rd_conf); break; case 'consumer': $rd_conf->set('fetch.message.max.bytes', self::CONSUMER_MESSAGE_MAX_BYTES); $this->consumer = new RdKafka\Consumer($rd_conf); $rd_topic_conf = new RdKafka\TopicConf(); $back = debug_backtrace(); $back = $back[1]; $group = $this->topic_name . "_" . $back['class'] . "_" . $back['function']; $rd_topic_conf->set('group.id', $group); $rd_topic_conf->set('auto.commit.interval.ms', 1000); $rd_topic_conf->set("offset.store.path", $this->offset_path); $rd_topic_conf->set('auto.offset.reset', 'smallest'); //$rd_topic_conf -> set('offset.store.method','broker');//flie(offset.store.path),broker //$rd_topic_conf -> set('offset.store.sync.interval.ms',60000);//fsync() interval for the offset file, in milliseconds. Use -1 to disable syncing, and 0 for immediate sync after each write. $this->consumer_topic = $this->consumer->newTopic($topic_name, $rd_topic_conf); break; } }
public static function generarPlantilla($plantilla, $datos, $enPDF = false) { $contenido = self::obtenerPlantilla($plantilla); if ($contenido == false) { $resultado = 'No hay plantilla'; } else { $claves = array_keys($datos); $valores = array_values($datos); foreach ($claves as $indice => $clave) { $claves[$indice] = '{' . $clave . '}'; } $resultado = str_replace($claves, $valores, $contenido); } if ($enPDF) { $mpdf = YII::app()->ePdf->mpdf(); $mpdf->WriteHTML($resultado); $mpdf->Output(); } else { echo $resultado; } }
public function actionAdd() { $model = new Blogshop(); $categories = Category::getAllCategories(); $selected_categories = array(); if (isset($_POST['Blogshop'])) { $model->attributes = $_POST['Blogshop']; $model->openidurl = YII::app()->user->id; if ($model->validate()) { $selected_categories = $_POST['category']; Yii::trace(print_r($_POST['category']), 'application'); if ($model->save()) { $model->addCategories($model->id, $selected_categories); $this->redirect(array('list')); } else { throw new CHttpException(500, 'Error in saving Blogshop.'); } } } $this->render('add', array('model' => $model, 'categories' => $categories, 'selected' => $selected_categories)); }
/** * UPDATE action. Only accessible by author and admin */ public function actionUpdate($id) { $post = Post::model()->findByPk($id); if (null == $post) { throw new CHttpException(404, 'Post not found.'); } if (!Yii::app()->user->isForumAdmin() && YII::app()->user->id != $post->author_id) { throw new CHttpException(403, 'You are not allowed to edit this post.'); } $thread = $post->thread; if (isset($_POST['Post'])) { if (!isset($_POST['YII_CSRF_TOKEN']) || $_POST['YII_CSRF_TOKEN'] != Yii::app()->getRequest()->getCsrfToken()) { throw new CHttpException(400, 'Invalid request. Please do not repeat this request again.'); } $post->attributes = $_POST['Post']; if ($post->validate()) { $post->save(false); $this->redirect($post->thread->url); } } $this->render('editpost', array('model' => $post, 'thread' => $thread)); }
public function actionIndex($propertyId) { $this->pageName = "billing"; if (Yii::app()->user->isGuest) { $this->redirect(basePath('?url=property/' . $propertyId)); } $this->updateActiveProperty($propertyId); $property = Properties::model()->findByPk($propertyId); YII::app()->user->setState("redirect_url", null); //$property->trialPeriodStartDate != null && if (!UserAccessTable::checkUser2PropertyAccess(Yii::app()->user->getState('id'), $propertyId, UserAccessTable::OWNER)) { Yii::app()->user->logout(); $this->redirect(basePath('?url=property/' . $propertyId)); } $adminMode = false; if (UserAccessTable::checkUser2PropertyAccess(Yii::app()->user->getState('id'), Yii::app()->user->getState('property_id'), UserAccessTable::OWNER)) { $adminMode = true; } if ($property->getAttribute('isdeactivated') == 0 && $property->trialPeriodStartDate == null) { $this->redirect(basePath('app/properties')); } //TODO Live // $DaysAfterTrialWhenUserCanReturnProperty = 7; // $TrialPeriod = 31; if ($property->trialPeriodStartDate != null) { $DaysAfterTrialWhenUserCanReturnProperty = 2; $TrialPeriod = 2; $allDays = $DaysAfterTrialWhenUserCanReturnProperty + $TrialPeriod; $trialStartDate = new DateTime($property->trialPeriodStartDate); $trialStartDate->modify("+{$allDays} day"); $nowDate = new DateTime(); if ($trialStartDate->format("Y/m/d") < $nowDate->format("Y/m/d")) { $this->redirect(basePath('app/properties')); } } $this->render('index', array('errors' => null, 'adminMode' => $adminMode, 'countries' => $this->getCountries(), 'provinces' => $this->getProvinces())); }
protected function _getSignUpData() { $allData = array('email', 'email_confirm', 'password', 'password_confirm', 'country', 'firstname', 'lastname', 'phone', 'property_name', 'street_one', 'street_two', 'city', 'state', 'zip', 'property_phone', 'agree', 'PP_FIRSTNAME', 'PP_LASTNAME', 'PP_ACCT', 'PP_CREDITCARDTYPE', 'PP_CCEXPIRYMTH', 'PP_CCEXPIRYYR', 'PP_CVV2', 'PP_COUNTRYCODE', 'PP_STREET', 'PP_CITY', 'PP_STATE', 'PP_ZIP', 'PP_STREET2'); $data = array(); foreach ($allData as $item) { $data[$item] = YII::app()->user->getFlash('signup_data_' . $item); } return $data; }
echo $form->errorSummary($model); ?> <?php echo $form->textFieldGroup($model, 'name', array('wrapperHtmlOptions' => array('class' => 'col-sm-5'))); ?> <?php echo $form->dropDownListGroup($model, 'yeshuv_id', array('wrapperHtmlOptions' => array('class' => 'col-sm-5'), 'widgetOptions' => array('data' => Yeshuv::model()->getYeshuvOptions(), 'htmlOptions' => array()))); ?> <?php echo $form->textFieldGroup($model, 'file_name', array('wrapperHtmlOptions' => array('class' => 'col-sm-5'), 'widgetOptions' => array('htmlOptions' => array('onClick' => 'js:openKCFinder(this)', 'style' => 'direction:ltr', 'readonly' => true, 'class' => 'default-cursor')))); ?> </fieldset> <div class="form-actions"> <?php $this->widget('booster.widgets.TbButton', array('buttonType' => 'submit', 'context' => 'primary', 'label' => YII::t('default', 'Submit'))); ?> <?php $this->widget('booster.widgets.TbButton', array('buttonType' => 'reset', 'label' => YII::t('default', 'Reset'))); ?> </div> <?php $this->endWidget(); ?> </div><!-- form -->
<?php /* @var $this CommercialController */ /* @var $model Commercial */ $this->breadcrumbs = array(YII::t('commercial', 'Commercials') => array('index'), YII::t('default', 'Create')); $this->menu = array(array('label' => YII::t('commercial', 'List Commercial Area'), 'url' => array('index')), array('label' => YII::t('commercial', 'Manage Commercial Area'), 'url' => array('admin'))); ?> <h1><?php echo YII::t('commercial', 'Create Commercial Area'); ?> </h1> <?php $this->renderPartial('_form', array('model' => $model));
public function actionDelete() { if ($this->access > UserAccessTable::FULL_ACCESS) { return 0; } $id = $_POST['id']; $calendarModel = new Calendar(); $calendarModel = $calendarModel->findByPk($id); if ($calendarModel == null || $calendarModel == false) { echo json_encode(array('result' => 0)); die; } $usersEmail = array(); if (YII::app()->request->getParam('notification', 0) == 1 || YII::app()->request->getParam('notification', 0) == true) { $links = $this->getPropertyMembers(); foreach ($links as $key => $link) { array_push($usersEmail, $link['user']['email']); } } $attrs = $calendarModel->attributes; $result = $calendarModel->deleteByPk($id); $date1 = new DateTime(); $end_date = date(strtotime($calendarModel->attributes['end_date'])); $date1->setTimestamp($end_date); $real_end_date = $date1->modify('-1 day'); $end_date1 = $real_end_date->format('F d, Y'); if ($result == 1 || $result == true) { $this->layout = "emailmaster"; $body = $this->render('../emails/emailCalendar', array('fullname' => Yii::app()->user->getState('firstname') . ' ' . Yii::app()->user->getState('lastname'), 'property' => $this->propertyName, 'start' => date('F d, Y', strtotime($attrs['create_date'])), 'end' => $end_date1, 'event' => $attrs['event'], 'message' => $attrs['notes'], 'action' => 'Deleted'), true); MailHelper::send($body, "SharedKey.com - " . $this->propertyName . " - Deleted Calendar Event", $usersEmail); } echo json_encode(array('result' => $result)); die; }
public function actionUpdate($id = false, $page = 1) { $role_id = Users::model()->findByPk(Yii::app()->user->id)->role_id; if ($role_id != 7 || $role_id == 7 && $id == 1) { $pages = new Pages(); if (!empty($id) && Pages::model()->existsPage($id)) { $active = Modules::model()->getActiveModule($id); $model = $pages->findByPk($id); if (isset($_POST['Pages'])) { if ($model->validate()) { $old_file_id = $model->image_id; if ($_POST['Pages']['image_id'] == 'NULL') { $_POST['Pages']['image_id'] = ''; } $model->attributes = $_POST['Pages']; if ($model->save()) { if ((int) $_POST['Pages']['image_id']) { Files::model()->saveTempFile((int) $_POST['Pages']['image_id']); } elseif ($_POST['Pages']['image_id'] == '') { Files::model()->deleteFile($old_file_id, 'page'); } if ($old_file_id != $model->image_id) { Files::model()->deleteFile($old_file_id, 'page'); } // Yii::app()->user->setFlash('message','<p style="color:green;">Сохранено</p>'); $this->redirect(YII::app()->baseUrl . '/admin.php?r=pages/update&id=' . $id); } else { // Yii::app()->user->setFlash('message','<p style="color:red;">Ошибка</p>'); } } } $image = Pages::model()->getImage($id, 'page'); $this->pageTitle = 'Редактирование раздела — ' . $model->name; $this->render('update', array('model' => $model, 'name' => $model->getPageNameById($id), 'active' => $active, 'image' => $image, 'page' => $page)); } else { $this->redirect(Yii::app()->request->baseUrl); } } else { $this->redirect(Yii::app()->baseUrl . '/admin.php?r=pages/access'); } }
echo $form->labelEx($model, 'who_add_id'); ?> <?php echo $form->textField($model, 'who_add_id', array('value' => YII::APP()->user->id, 'readonly' => 'readonly')); ?> <?php echo $form->error($model, 'who_add_id'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'who_add_name'); ?> <?php echo $form->textField($model, 'who_add_name', array('value' => YII::APP()->user->name, 'readonly' => 'readonly', 'size' => 60, 'maxlength' => 255)); ?> <?php echo $form->error($model, 'who_add_name'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'last_activity_date'); ?> <?php echo $form->textField($model, 'last_activity_date', array('size' => 60, 'maxlength' => 255, 'value' => date('Y-m-d'), 'readonly' => 'readonly')); ?> <?php echo $form->error($model, 'last_activity_date'); ?>
?> /js/handsontable/moment/moment.js"></script> <script data-jsfiddle="common" src="<?php echo Yii::app()->request->baseUrl; ?> /js/handsontable/zeroclipboard/ZeroClipboard.js"></script> <script data-jsfiddle="common" src="<?php echo Yii::app()->request->baseUrl; ?> /js/handsontable/handsontable.js"></script> </head> <body> <?php $this->widget('bootstrap.widgets.TbNavbar', array('items' => array(array('class' => 'bootstrap.widgets.TbMenu', 'htmlOptions' => array('class' => 'pull-right'), 'encodeLabel' => false, 'items' => array(array('label' => 'Gửi SMS', 'items' => array(array('label' => 'Chăn sóc khách hàng', 'url' => '#'), array('label' => 'Quảng cáo', 'url' => '#')), 'visible' => !Yii::app()->user->isGuest), array('label' => 'Tin nhắn mẫu', 'url' => array('/templatesms/admin'), 'visible' => !Yii::app()->user->isGuest), array('label' => 'Danh bạ', 'url' => array('/contactCategorie/admin'), 'visible' => !Yii::app()->user->isGuest), array('label' => 'Nhật ký gửi SMS', 'url' => array('/history/admin'), 'visible' => !Yii::app()->user->isGuest), array('label' => 'Tìm kiếm', 'url' => '#', 'visible' => !Yii::app()->user->isGuest), array('label' => 'Báo cáo', 'url' => '#', 'visible' => !Yii::app()->user->isGuest), array('label' => 'Thành viên', 'url' => array('/Members'), 'visible' => !Yii::app()->user->isGuest), array('label' => 'Login', 'url' => array('/site/login'), 'visible' => Yii::app()->user->isGuest), array('label' => Yii::app()->user->name, 'url' => '#', 'items' => array(array('label' => 'Thông tin cá nhân', 'url' => array('/Members/default/view', 'id' => YII::app()->user->id)), array('label' => 'Logout(' . Yii::app()->user->name . ')', 'url' => array('/site/logout'), 'visible' => !Yii::app()->user->isGuest)), 'visible' => !Yii::app()->user->isGuest)))))); ?> <div class="container" id="page"> <?php if (isset($this->breadcrumbs)) { ?> <?php $this->widget('bootstrap.widgets.TbBreadcrumbs', array('links' => $this->breadcrumbs)); ?> <!-- breadcrumbs --> <?php } ?>
<?php /* @var $this AdController */ /* @var $model Ad */ $this->breadcrumbs = array(YII::t('ad', 'Ads') => array('screen/' . $this->getScreen()->id), YII::t('default', 'Create')); ?> <h1><?php echo YII::t('ad', 'Create Ad for Screen:') . ' ' . $this->getScreen()->name; ?> </h1> <?php $this->renderPartial('_form', array('model' => $model));
/** * @return array customized attribute labels (name=>label) */ public function attributeLabels() { return array('id' => Yii::t('theme', 'Theme'), 'theme' => Yii::t('theme', 'Theme'), 'description' => Yii::t('theme', 'Description'), 'create_time' => YII::t('default', 'Create Time'), 'create_user_id' => YII::t('default', 'Create User'), 'update_time' => YII::t('default', 'Update Time'), 'update_user_id' => YII::t('default', 'Update User')); }
echo Yii::t('lang', 'Fields with * are required'); ?> .</p> <?php echo $form->errorSummary($model); echo '<div class="accordion" id="accordion2">'; /** * ============= BASIC INFORMATION */ // accordion group starts echo '<div class="accordion-group">'; // heading echo '<div class="accordion-heading lb_accordion_heading">'; echo '<a class="accordion-toggle lb_accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#form-new-customer-basic-info-collapse">'; echo YII::t('lang', 'Basic Information'); echo '</a></div>'; // end heading // body echo '<div id="form-new-customer-basic-info-collapse" class="accordion-body collapse in"> <div class="accordion-inner">'; echo $form->textFieldRow($model, 'lb_customer_name', array('class' => 'span6', 'maxlength' => 255)); echo $form->error($model, 'lb_customer_name'); echo $form->textFieldRow($model, 'lb_customer_website_url', array('class' => 'span6')); echo $form->error($model, 'lb_customer_website_url'); echo $form->textFieldRow($model, 'lb_customer_registration', array()); echo $form->error($model, 'lb_customer_registration'); if ($own) { echo $form->checkBoxRow($model, 'lb_customer_is_own_company', array("checked" => "checked")); } else { echo $form->checkBoxRow($model, 'lb_customer_is_own_company');
</br> <?php echo CHtml::link('GO BACK', YII::app()->request->urlReferrer); $this->widget('zii.widgets.grid.CGridView', array('id' => 'student-docs-final_view', 'dataProvider' => $studentdocstrans->mysearch(), 'enableSorting' => false, 'nullDisplay' => 'N/A', 'columns' => array(array('header' => 'SN.', 'class' => 'IndexColumn'), array('name' => 'Title', 'type' => 'raw', 'value' => 'CHtml::link(CHtml::encode($data->Rel_Stud_doc->title),"../stud_docs/".$data->Rel_Stud_doc->student_docs_path, $htmlOptions=array("target"=>"_blank"))'), array('name' => 'Document Category', 'value' => 'DocumentCategoryMaster::model()->findByPk($data->Rel_Stud_doc->doc_category_id)->doc_category_name'), array('name' => 'Description', 'value' => '$data->Rel_Stud_doc->student_docs_desc'), array('name' => 'Submit Date', 'value' => 'date_format(new DateTime($data->Rel_Stud_doc->student_docs_submit_date), "d-m-Y")'), array('class' => 'MyCButtonColumn', 'template' => '{delete}', 'buttons' => array('delete' => array('url' => 'Yii::app()->createUrl("studentDocsTrans/delete", array("id"=>$data->student_docs_trans_id))'))))));
?> <?php echo $form->textFieldGroup($model, 'alias_url', array('widgetOptions' => array('htmlOptions' => array('class' => 'span5', 'maxlength' => 50)))); ?> <?php echo $form->fileFieldGroup($model, 'picture', array('widgetOptions' => array('htmlOptions' => array('id' => 'picture_file', 'onchange' => 'getimage()')))); ?> <?php if ($model->picture) { ?> <img id="picture_category" src="<?php echo YII::app()->baseUrl . '/images/categories/' . $model->picture; ?> " alt='' height='100px'><?php } else { ?> <img id="picture_category" alt='' height="100px" style='display: none;'> <?php } ?> <div class="form-actions"> <?php $this->widget('booster.widgets.TbButton', array('buttonType' => 'submit', 'context' => 'primary', 'label' => $model->isNewRecord ? 'Create' : 'Save')); ?> </div>
?> <?php /* @var $this LbInvoiceController */ /* @var $model LbInvoice */ /* @var $ownCompany LbCustomer */ // header container div echo '<div id="invoice-header-container" class="container-header" style="position: relative">'; //echo $model->lb_vendor_company_id; echo '<div id="logo_wrapper" style="overflow:hidden;text-align: center;">'; // $company = (isset($model->owner) ? $model->lb_vendor_company_id : ''); $folder = 'images/logo/'; // $model=LbVendor::model()->findByPk($id); $company = $model->lb_vd_invoice_company_id; $path = YII::app()->baseUrl . "/images/logo/"; $filename = ''; $file_arr = array_diff(scandir($folder), array('.', '..')); $subcription = LBApplication::getCurrentlySelectedSubscription(); foreach ($file_arr as $key => $file) { $file_name = explode('.', $file); $file_name_arr = explode('_', $file_name[0]); // print_r($file_name_arr); if ($file_name_arr[0] == $subcription && $file_name_arr[1] == $company) { echo "<img src='" . $path . $file . "' style='max-height:120px' />"; } } $this->widget('ext.EAjaxUpload.EAjaxUpload', array('id' => 'uploadFile', 'config' => array('action' => $this->createUrl('uploadLogo', array('id' => $model->lb_record_primary_key, 'sub_cription' => $subcription, 'company_id' => $company)), 'allowedExtensions' => array("jpeg", "jpg", "gif", "png"), 'sizeLimit' => 10 * 1024 * 1024, 'minSizeLimit' => 1 * 1024, 'multiple' => true, 'onComplete' => "js:function(id, fileName, responseJSON){\n \$('#uploadFile .qq-upload-list').html('');\n //\$('#logo_wrapper img').attr('src','" . $path . "'+fileName);\n window,location.reload(true);\n }"))); echo '</div>'; //echo '<h3 id="po-number-container">'.$model->getDisplayPOStatus($model->lb_vendor_status).'</h3>'; echo '<div id="invoice-basic-info-container" style="float: left;width:36%;">';
function(response){ var responseJSON = jQuery.parseJSON(response); if(responseJSON.success == 0) { // alert("Payment voucher no already exists. Please enter payment voucher no other"); // window.location.href = '<?php // echo YII::app()->baseUrl; ?> /index.php/lbExpenses/default/CreatePaymentVoucher/id/'+responseJSON.id; } else { alert('Successful Payment Voucher'); window.location.href = '<?php echo YII::app()->baseUrl; ?> /index.php/lbExpenses/default/CreatePaymentVoucher/id/'+responseJSON.id; } } ); } } function deleteComment(id) { $.post("<?php echo LbComment::model()->getActionURLNormalized('deleteComment', array()); ?> ", {id:id},
public function actionUpdate() { $data = array(); $getList = array('title' => '', 'text' => ''); foreach ($getList as $key => $default) { $data[$key] = YII::app()->request->getPost($key, $default); } $data['updatetime'] = date('Y-m-d h:i:s'); if (YII::app()->request->getPost('date')) { $data['createtime'] = YII::app()->request->getPost('date') . ' 00:00:00'; $data['createtime'] = str_replace('/', '-', $data['createtime']); } $property_id = Yii::app()->user->getState('property_id', 0); $id = YII::app()->request->getPost('id', 0); $Guestbook2userModel = new Guestbook2user(); $link = $Guestbook2userModel->findByAttributes(array('user_id' => Yii::app()->user->getState('id'), 'guestbook_id' => $id)); if ($link == null && $this->access > UserAccessTable::FULL_ACCESS) { $result = false; $resultData = array(); } else { $result = $this->model->updateByPk($id, $data, "property_id = {$property_id}"); $item = $this->model->with('file2Guestbooks', 'guestbook2users')->findByPk($id); $resultData = $item->getAttributes(); $files = YII::app()->request->getPost('files', array()); $fileModel = new File2Guestbook(); $fileModel->deleteAllByAttributes(array('guestbookid' => $id)); foreach ($files as $file) { $fileModel = new File2Guestbook(); $fileModel->unsetAttributes(); $fileModel->setAttributes(array('fileid' => $file['id'], 'index' => $file['index'], 'guestbookid' => $id)); $result = $fileModel->save(); } $resultData['files'] = array(); $resultData['access'] = true; $item = $this->model->with('file2Guestbooks')->findByPk($id); foreach ($item->file2Guestbooks as $file) { $fileData = $file->file->getAttributes(); $fileData['index'] = $file->getAttribute('index'); $resultData['files'][] = $fileData; } } $this->renderPartial('update', array('data' => $resultData, 'result' => $result)); }