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;
 }
Esempio n. 3
0
 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;
 }
Esempio n. 4
0
 /**
  *
  * 
  * @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));
 }
Esempio n. 7
0
 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;
 }
Esempio n. 8
0
 /**
  *上传多个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>';
 }
Esempio n. 10
0
 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;
     }
 }
Esempio n. 12
0
 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));
 }
Esempio n. 13
0
 /**
  * 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));
 }
Esempio n. 14
0
 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 getTutorialState($tutorialId)
 {
     $isTest = YII::app()->user->getState('testWe');
     if ($isTest) {
         return 1;
     } else {
         return $this->access <= UserAccessTable::BASIC_ACCESS ? Yii::app()->user->getState('tutorial_' . $tutorialId) : 0;
     }
 }
Esempio n. 16
0
?>

	<?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>
Esempio n. 17
0
?>


<?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%;">';
Esempio n. 18
0
    <!-- <div class="cdt_line_spc"><span></span></div>-->

    <?php $listImagen = $objProducto->listImagen(YII::app()->params->producto['tipoImagen']['grande']); ?>
    <?php if ($objProducto->fraccionado == 1): ?>
    <div class="cdiv_prod_frc">
        <div class="c_prod_frc">
            <p class="">Producto fraccionado</p>
        </div>
    </div>
    <?php endif; ?>
    <div id="owl-productodetalle-<?php echo $objProducto->codigoProducto ?>" class="owl-carousel owl-theme owl-productodetalle">
        <?php if (empty($listImagen)): ?>
            <div class="item"><img src="<?php echo Yii::app()->request->baseUrl . Yii::app()->params->producto['noImagen']['grande']; ?>" alt="<?php echo $objProducto->descripcionProducto ?>" title="<?php echo $objProducto->descripcionProducto ?>"></div>
        <?php else: ?>
            <?php foreach ($listImagen as $imagen): ?>
                <div class="item"><img src="<?php echo Yii::app()->request->baseUrl . Yii::app()->params->carpetaImagen['productos'][YII::app()->params->producto['tipoImagen']['grande']] . $imagen->rutaImagen; ?>" alt="<?php echo $imagen->nombreImagen ?>" title="<?php echo $imagen->tituloImagen ?>"></div>
            <?php endforeach; ?>
        <?php endif; ?>
    </div>

    <div class="cdt_line_spc"><span></span></div>

    <?php if(!in_array($objProducto->idCategoriaBI, Yii::app()->params->calificacion['categoriasNoCalificacion'])): ?>
        <div id="raty-lectura-producto-<?php echo $objProducto->codigoProducto ?>" data-role="raty" data-readonly="true" data-score="<?php echo $objProducto->getCalificacion() ?>" class="clst_cal_str"></div>
        <?php $calificacion = $objProducto->getCalificacion(true) ?>
        <div><strong>Total votos:</strong> <?php echo $calificacion['votos'] ?></div>
        <div><strong>Votación:</strong> <?php echo $calificacion['calificacion'] ?></div>
        <?php if (Yii::app()->user->isGuest): ?>
            <p class="txt_inise_cal_stars">Iniciar sesión para calificar este producto</p>
        <?php endif; ?>
    <?php endif; ?>
<div class="clst_cont_top">
    <?php $imagen = $position->objProducto->objImagen(YII::app()->params->producto['tipoImagen']['mini']); ?>

    <?php if ($imagen == null): ?>
        <div class="clst_pro_img">
            <a href="<?php echo CController::createUrl('/catalogo/producto', array('producto' => $position->objProducto->codigoProducto,'descripcion'=>  Producto::cadenaUrl($position->objProducto->descripcionProducto))) ?>" data-ajax="false">
                <img src="<?php echo Yii::app()->request->baseUrl . Yii::app()->params->producto['noImagen']['mini']; ?>" class="ui-li-thumb">
            </a>
        </div>
    <?php else: ?>
        <div class="clst_pro_img">
            <a href="<?php echo CController::createUrl('/catalogo/producto', array('producto' => $position->objProducto->codigoProducto,'descripcion'=>  Producto::cadenaUrl($position->objProducto->descripcionProducto))) ?>" data-ajax="false">
                <img src="<?php echo Yii::app()->request->baseUrl . Yii::app()->params->carpetaImagen['productos'][YII::app()->params->producto['tipoImagen']['mini']] . $imagen->rutaImagen; ?>" class="ui-li-thumb">
            </a>
        </div>
    <?php endif; ?>

    <div class="clst_cont_pr_prod">
        <h2><a href="<?php echo CController::createUrl('/catalogo/producto', array('producto' => $position->objProducto->codigoProducto,'descripcion'=>  Producto::cadenaUrl($position->objProducto->descripcionProducto))) ?>" data-ajax="false"><?php echo $position->objProducto->descripcionProducto ?></a></h2>
        <p><?php echo $position->objProducto->presentacionProducto ?></p>
        <?php if ($position->objProducto->mostrarAhorroVirtual == 1 && $position->getDiscountPrice() > 0): ?>
            <div class="clst_pre_ant"><?php echo Yii::app()->numberFormatter->format(Yii::app()->params->formatoMoneda['patron'], $position->getPrice(false), Yii::app()->params->formatoMoneda['moneda']); ?></div>
            <div class="clst_pre_act"><?php echo Yii::app()->numberFormatter->format(Yii::app()->params->formatoMoneda['patron'], $position->getPrice(), Yii::app()->params->formatoMoneda['moneda']); ?>  <span>[Ahorro <?php echo Yii::app()->numberFormatter->format(Yii::app()->params->formatoMoneda['patron'], $position->getDiscountPrice(), Yii::app()->params->formatoMoneda['moneda']); ?>]</span></div>
        <?php else: ?>
            <div class="clst_pre_act"><?php echo Yii::app()->numberFormatter->format(Yii::app()->params->formatoMoneda['patron'], $position->getPrice(), Yii::app()->params->formatoMoneda['moneda']); ?> </div>
        <?php endif; ?>

        <?php if ($position->getShipping() > 0): ?>
            <div class="clst_pre_act"><span>[Flete <?php echo Yii::app()->numberFormatter->format(Yii::app()->params->formatoMoneda['patron'], $position->getShipping(), Yii::app()->params->formatoMoneda['moneda']); ?>]</span></div>
        <?php endif; ?>
Esempio n. 20
0
?>
/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 
}
?>
Esempio n. 21
0
 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));
 }
Esempio n. 22
0
 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;
 }
Esempio n. 23
0
 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');
     }
 }
            <td style="border-left:1px solid #dddddd;border-top:1px solid #dddddd;vertical-align:top;text-align:center;line-height:20px;padding:8px" rowspan="2"><?php echo Yii::app()->numberFormatter->format(Yii::app()->params->formatoMoneda['patron'], $position->getDiscountPrice(), Yii::app()->params->formatoMoneda['moneda']); ?></td>
            <td style="border-left:1px solid #dddddd;border-top:1px solid #dddddd;vertical-align:top;text-align:center;line-height:20px;padding:8px" rowspan="2"><?php echo Yii::app()->numberFormatter->format(Yii::app()->params->formatoMoneda['patron'], $position->getSumPrice(), Yii::app()->params->formatoMoneda['moneda']); ?></td>
    </tr>
    <tr style="vertical-align:middle; <?php echo ($indice % 2 != 0 ? "background-color:#f9f9f9;" : "")?>">
            <td style="text-align:center;border-left:1px solid #dddddd;border-top:1px solid #dddddd;vertical-align:top;line-height:20px;padding:8px">Unidades bodega: <?php echo $position->getQuantityStored()?></td>
<?php else: ?>
<td style="text-align:left;line-height:20px;border-top:1px solid #dddddd;vertical-align:top;padding:8px">
    <p>
        <?php $imagen = $position->objProducto->objImagen(YII::app()->params->producto['tipoImagen']['mini']); ?>
        <?php if ($imagen == null): ?>
            <a target="_blank" href="<?php echo CController::createAbsoluteUrl('/catalogo/producto', array('producto' => $position->objProducto->codigoProducto)) ?>">
                <img class="CToWUd" width="70" height="70" align="left" src="<?php echo CController::createAbsoluteUrl('/') . Yii::app()->params->producto['noImagen']['mini']; ?>" title="" style="margin-right:7px;margin-bottom:13px;float:left">
            </a>
        <?php else: ?>
            <a target="_blank" href="<?php echo CController::createAbsoluteUrl('/catalogo/producto', array('producto' => $position->objProducto->codigoProducto)) ?>">
                <img class="CToWUd" width="70" height="70" align="left" src="<?php echo CController::createAbsoluteUrl('/') . Yii::app()->params->carpetaImagen['productos'][YII::app()->params->producto['tipoImagen']['mini']] . $imagen->rutaImagen; ?>" title="" style="margin-right:7px;margin-bottom:13px;float:left">
            </a>
        <?php endif; ?>
    </p>
    <p style="margin:0">
        <a target="_blank" href="<?php echo CController::createAbsoluteUrl('/catalogo/producto', array('producto' => $position->objProducto->codigoProducto)) ?>" style="color:#0088cc;text-decoration:none">
            <b><?php echo $position->objProducto->descripcionProducto ?></b>
        </a>
    </p>
    <p style="color:#666666;font-size:12px;margin-top:0;font-weight:bold">Codigo: <?php echo $position->objProducto->codigoProducto ?></p>
    <p style="color:#666666;font-size:12px;line-height:16px"></p>
</td>
<td style="text-align:center;border-left:1px solid #dddddd;border-top:1px solid #dddddd;vertical-align:top;line-height:20px;padding:8px"><?php echo $position->getQuantity()?></td>
<td style="border-left:1px solid #dddddd;border-top:1px solid #dddddd;vertical-align:top;text-align:center;line-height:20px;padding:8px">
    <span style="text-decoration:line-through;color:#a40014"><?php echo Yii::app()->numberFormatter->format(Yii::app()->params->formatoMoneda['patron'], $position->getPrice(false, false), Yii::app()->params->formatoMoneda['moneda']); ?></span>
    <br>
Esempio n. 25
0
 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;
 }
Esempio n. 26
0
 public function actionUpdateSortOrder()
 {
     $orders = YII::app()->request->getParam('orders', null);
     $index = 0;
     foreach ($orders as $item) {
         $houseRule = Houserules::model()->findByPk($item);
         $houseRule->setAttribute('sort', $index);
         $houseRule->save();
         $index++;
     }
 }
</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))'))))));
Esempio n. 28
0
//	array('label'=>'List ProcessChecklistDefault', 'url'=>array('index')),
//	array('label'=>'Create ProcessChecklistDefault', 'url'=>array('create')),
//);
//Yii::app()->clientScript->registerScript('search', "
//$('.search-button').click(function(){
//	$('.search-form').toggle();
//	return false;
//});
//$('.search-form form').submit(function(){
//	$('#process-checklist-default-grid').yiiGridView('update', {
//		data: $(this).serialize()
//	});
//	return false;
//});
//");
require_once YII::app()->modulePath . '/process_checklist/js/jquery-ui-1.11.1.js.php';
?>
<h1><a href="<?php 
echo $this->createUrl('/process_checklist/processChecklist/admin');
?>
" style="color: #000"><i class="icon-chevron-left" style="margin-top: 18px;"></i><?php 
echo $modelChecklist->pc_name;
?>
</a></h1>
<div id="process-checklist-default">
    <?php 
$this->widget('bootstrap.widgets.TbGridView', array('id' => 'process-checklist-default-grid', 'dataProvider' => $model, 'type' => 'striped bordered condensed', 'rowHtmlOptionsExpression' => 'array("id"=>"row_item_".$data->pcdi_id)', 'columns' => array(array('name' => 'pcdi_name', 'footer' => CHtml::textArea('pcdi_name', '', array('cols' => '100', 'rows' => '1', 'class' => 'span6'))), array('class' => 'bootstrap.widgets.TbButtonColumn', 'template' => "{update}{delete}{sort}", 'footer' => CHtml::button('Add', array('name' => 'add_pcdi_name', 'onclick' => 'AjaxPCDI_name();return false', 'class' => 'btn', 'style' => 'text-align:center')), 'htmlOptions' => array('width' => '70', 'style' => 'text-align:center'), 'buttons' => array('sort' => array('label' => '<i id="item-sort" class="icon-align-justify"></i>', 'options' => array('title' => 'View Sessions'), 'imageUrl' => false))))));
?>
</div>
<script type="text/javascript">
 
Esempio n. 29
0
                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},
Esempio n. 30
0
 public function actionRemoveproperty($id)
 {
     $userId = Yii::app()->user->getState('id');
     //all users can remove itself from property member's list
     if (!UserAccessTable::checkUser2PropertyAccess($userId, $id, UserAccessTable::GUEST)) {
         Yii::app()->request->redirect(basePath('app/gallery'));
     }
     $user2property = User2property::model()->findByAttributes(array('userId' => $userId, 'propertyId' => $id));
     if ($user2property->getAttribute('access') != UserAccessTable::OWNER) {
         //email to member (NOT admin)
         $this->layout = "emailmaster";
         $body = $this->render("../emails/emailItselfRemove", array('name' => $user2property->user->getAttribute('firstname') . ' ' . $user2property->user->getAttribute('lastname'), 'propertyName' => $user2property->property->getAttribute('property_name')), true);
         MailHelper::send($body, "SharedKey - Removed Property", array($user2property->user->getAttribute('email')));
         //clear calendar events first
         $calendar = new Calendar();
         $calendar = $calendar->findAllByAttributes(array('linkid' => $user2property->getAttribute('id')));
         foreach ($calendar as $cal) {
             $cal->delete();
         }
         //for not property Administrator we just remove a link to property
         $user2property->delete();
         if ($this->_isAllUserPropertiesDeactivated($userId)) {
             //removed last property need remove user
             $this->removeUser($userId);
             return;
         }
         Yii::app()->request->redirect(basePath('app/properties'));
         return;
     }
     //member is administrator we need cancel RecurringPaymentsProfile and deactivate property
     //lets find last transaction
     $transaction = Transaction::model()->findByAttributes(array('userid' => $userId, 'propertyid' => $id));
     if (!$transaction) {
         //no previous transactions not need to refund
     }
     $userApi = sharedkeyApi::create('usersAPI');
     $userEmail = Yii::app()->user->getState('email');
     $userApi->addParams(array('email' => $userEmail));
     $byEmail = json_decode($userApi->byEmail('get'));
     $userData = (array) $byEmail->data;
     $userData['property_id'] = $id;
     //close RecurringPaymentsProfile
     if ($transaction) {
         YII::app()->user->setState("addPropertyEmailed", true);
         $temp = PayPalHelper::cancelRecurringPaymentsProfile($transaction->getAttribute('pp_PROFILEID'), $userData);
     }
     //do deactivated
     $property = Properties::model()->findByPk($id);
     $property->isdeactivated = 1;
     $property->edt = new CDbExpression('NOW()');
     //$property->trialPeriodStartDate = null;
     $property->save();
     $this->layout = "emailmaster";
     //mail to admin
     $token = uniqid();
     $body = $this->render("../emails/emailAdminAfterRemove", array('name' => Yii::app()->user->getState('firstname') . ' ' . Yii::app()->user->getState('lastname'), 'propertyName' => $property->getAttribute('property_name'), 'url' => basePathByHost("/app/changeactiveproperty/" . $property->getAttribute("id")) . '?token=' . $token), true);
     MailHelper::send($body, "SharedKey - Removed Property", array($userEmail));
     //informative other user about property deactivated
     $users2properties = User2property::model()->with('user')->findAll('propertyId=:propertyId', array(':propertyId' => $id));
     foreach ($users2properties as $key => $u2p) {
         if ($u2p->getAttribute('access') == UserAccessTable::OWNER) {
             continue;
         }
     }
     if ($this->_isAllUserPropertiesDeactivated($userId)) {
         $user = User::model()->find('id=:id', array(':id' => $userId));
         $user->verificationToken = $token;
         $user->save();
         $this->redirect(basePath('user/logout'));
         return;
     }
     Yii::app()->request->redirect(basePath('app/properties'));
 }