Exemplo n.º 1
0
 protected function renderContent()
 {
     if (isset($this->block) && $this->block != null) {
         if (isset($_POST['ResetAvatar'])) {
             //So we will start to check the info from the user
             $current_user = User::model()->findByPk(user()->id);
             if ($current_user) {
                 if ($current_user->avatar != null && $current_user->avatar != '') {
                     //We will delete the old avatar here
                     $old_avatar_path = $current_user->avatar;
                     if (file_exists(AVATAR_FOLDER . DIRECTORY_SEPARATOR . 'root' . DIRECTORY_SEPARATOR . $old_avatar_path)) {
                         @unlink(AVATAR_FOLDER . DIRECTORY_SEPARATOR . 'root' . DIRECTORY_SEPARATOR . $old_avatar_path);
                     }
                     //Delete old file Sizes
                     $sizes = AvatarSize::getSizes();
                     foreach ($sizes as $size) {
                         if (file_exists(AVATAR_FOLDER . DIRECTORY_SEPARATOR . $size['id'] . DIRECTORY_SEPARATOR . $old_avatar_path)) {
                             @unlink(AVATAR_FOLDER . DIRECTORY_SEPARATOR . $size['id'] . DIRECTORY_SEPARATOR . $old_avatar_path);
                         }
                     }
                     $current_user->avatar = '';
                     if ($current_user->save()) {
                         echo "1";
                         Yii::app()->end();
                     }
                 }
             } else {
                 throw new CHttpException('403', 'Wrong Link!');
             }
         }
         Yii::app()->controller->redirect(bu() . '/profile');
     }
 }
Exemplo n.º 2
0
 public function actionImagelist($attr)
 {
     $attribute = strtolower($attr);
     $uploadPath = Yii::app()->basePath . '/../images';
     $uploadUrl = bu('images');
     if ($uploadPath === null) {
         $path = Yii::app()->basePath . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'uploads';
         $uploadPath = realpath($path);
         if ($uploadPath === false) {
             exit;
         }
     }
     if ($uploadUrl === null) {
         $uploadUrl = Yii::app()->request->baseUrl . '/uploads';
     }
     $attributePath = $uploadPath . DIRECTORY_SEPARATOR . $attribute;
     $attributeUrl = $uploadUrl . '/' . $attribute . '/';
     $files = CFileHelper::findFiles($attributePath, array('fileTypes' => array('gif', 'png', 'jpg', 'jpeg'), 'level' => 0));
     $data = array();
     if ($files) {
         foreach ($files as $file) {
             $data[] = array('thumb' => $attributeUrl . basename($file), 'image' => $attributeUrl . basename($file));
         }
     }
     echo CJSON::encode($data);
     exit;
 }
Exemplo n.º 3
0
 public static function getSelect($menu)
 {
     date_default_timezone_set('America/Bogota');
     setlocale(LC_ALL, 'es_ES.UTF-8');
     $base = bu('programacion');
     $hoy = mktime(0, 0, 0, date('m'), date('j'), date('Y'));
     $html = '';
     $manana = $hoy + 86400;
     $ya = false;
     $ruri = Yii::app()->request->requestUri;
     $html .= '<select name="dia_programacion" id="dia_programacion">';
     foreach ($menu as $item) {
         $selected = '';
         $url = $base . '?dia=' . date('j', $item) . '&mes=' . date('m', $item) . '&anio=' . date('Y', $item);
         if (!$ya) {
             if ($url == $ruri) {
                 $selected = " selected='selected'";
                 $ya = true;
             } elseif ($item >= $hoy && $item < $manana) {
                 $selected = " selected='selected'";
             } else {
                 $selected = '';
             }
         }
         $html .= '<option value="' . $url . '"' . $selected . '>';
         $html .= ucfirst(strftime("%A", $item)) . ' ' . strftime("%e", $item);
         $html .= '</option>';
     }
     $html .= '</select>';
     return $html;
 }
Exemplo n.º 4
0
 public function actionSalir()
 {
     Yii::app()->user->logout();
     Yii::app()->session->clear();
     Yii::app()->session->destroy();
     $this->redirect(bu('/'));
 }
Exemplo n.º 5
0
 /** Render widget */
 public function run()
 {
     /** @var $cs CClientScript */
     $cs = Yii::app()->clientScript;
     $cs->registerCssFile($this->assets . '/galleryManager.css');
     $cs->registerCoreScript('jquery');
     $cs->registerCoreScript('jquery.ui');
     if (YII_DEBUG) {
         $cs->registerScriptFile($this->assets . '/jquery.iframe-transport.js', CClientScript::POS_END);
         $cs->registerScriptFile($this->assets . '/jquery.galleryManager.js', CClientScript::POS_END);
     } else {
         $cs->registerScriptFile($this->assets . '/jquery.iframe-transport.min.js', CClientScript::POS_END);
         $cs->registerScriptFile($this->assets . '/jquery.galleryManager.min.js', CClientScript::POS_END);
     }
     if ($this->controllerRoute === null) {
         throw new CException('$controllerRoute must be set.', 500);
     }
     $photos = array();
     foreach ($this->gallery->galleryPhotos as $photo) {
         $af = AlbumFoto::model()->findByPk($photo->album_foto_id);
         $photos[] = array('id' => $photo->id, 'rank' => $photo->orden, 'nombre' => (string) $photo->nombre, 'descripcion' => (string) $photo->descripcion, 'preview' => bu('images/galeria/' . $af->directorio . $photo->thumb));
     }
     $opts = array('hasName' => true, 'hasDesc' => true, 'uploadUrl' => Yii::app()->createUrl($this->controllerRoute . '/ajaxUpload', array('album_foto_id' => $this->gallery->id)), 'deleteUrl' => Yii::app()->createUrl($this->controllerRoute . '/delete'), 'updateUrl' => Yii::app()->createUrl($this->controllerRoute . '/changeData'), 'arrangeUrl' => Yii::app()->createUrl($this->controllerRoute . '/order'), 'nameLabel' => Yii::t('galleryManager.main', 'Name'), 'descriptionLabel' => Yii::t('galleryManager.main', 'Description'), 'photos' => $photos);
     if (Yii::app()->request->enableCsrfValidation) {
         $opts['csrfTokenName'] = Yii::app()->request->csrfTokenName;
         $opts['csrfToken'] = Yii::app()->request->csrfToken;
     }
     $opts = CJavaScript::encode($opts);
     $cs->registerScript('galleryManager#' . $this->id, "\$('#{$this->id}').galleryManager({$opts});");
     $this->htmlOptions['id'] = $this->id;
     $this->htmlOptions['class'] = 'GalleryEditor';
     $this->render('galleryManager');
 }
Exemplo n.º 6
0
 function del($id)
 {
     $this->db->where($this->idkey, $id);
     $this->db->delete($this->table);
     echo "<script type='text/javascript'>alert ('Запись Удалена!');</script>";
     echo "<html><head><meta HTTP-EQUIV='REFRESH' CONTENT='0;URL=" . bu() . "'></head></html>";
 }
Exemplo n.º 7
0
 public function display_seo($title = '')
 {
     $base = 'http://telemedellin.tv';
     $bu = Yii::app()->request->baseUrl;
     $ru = Yii::app()->request->requestUri;
     $titulo = $title != '' ? h($title) . ' - ' : '';
     $titulo .= 'Telemedellín, aquí te ves';
     echo '<meta charset="utf-8">' . PHP_EOL;
     //Pilas con el icono para Apple y esos metas
     echo "\t" . '<meta name="viewport" content="width=device-width, initial-scale=1">' . PHP_EOL;
     echo "\t" . '<link rel="canonical" href="' . $base . $ru . '">' . PHP_EOL;
     echo "\t" . '<link rel="shortcut icon" href="' . bu('/favicon.ico') . '">' . PHP_EOL;
     if ($this->pageRobotsIndex == false) {
         // Option for NoIndex
         echo "\t" . '<meta name="robots" content="noindex">' . PHP_EOL;
     }
     echo "\t" . '<title>' . $titulo . '</title>' . PHP_EOL;
     echo "\t" . '<meta name="description" content="', h(trim(substr(strip_tags($this->pageDesc), 0, 160))), '">' . PHP_EOL;
     echo "\t" . '<meta property="og:title" content="' . $titulo . '">' . PHP_EOL;
     echo "\t" . '<meta property="og:type" content="website">' . PHP_EOL;
     echo "\t" . '<meta property="og:url" content="' . $base . $ru . '">' . PHP_EOL;
     echo "\t" . '<meta property="og:image" content="' . $base . $this->pageImg . '">' . PHP_EOL;
     echo "\t" . '<meta name="twitter:card" content="summary_large_image">' . PHP_EOL;
     echo "\t" . '<meta name="twitter:site" content="@telemedellin">' . PHP_EOL;
     echo "\t" . '<meta name="twitter:creator" content="@telemedellin">' . PHP_EOL;
     echo "\t" . '<meta name="twitter:title" content="' . $titulo . '">' . PHP_EOL;
     echo "\t" . '<meta name="twitter:description" content="' . h(trim(substr(strip_tags($this->pageDesc), 0, 160))) . '">' . PHP_EOL;
     echo "\t" . '<meta name="twitter:image:src" content="' . $base . $this->pageImg . '">' . PHP_EOL;
 }
Exemplo n.º 8
0
 public function registerBootstrap3CoreAssets()
 {
     //bootstrap css
     app()->params['bootswatch3_skin'] == "none" ? cs()->registerCssFile(bu() . '/libs/bootstrap/dist/css/bootstrap.css') : cs()->registerCssFile(bu() . '/libs/bootswatch/' . app()->params['bootswatch3_skin'] . '/bootstrap.min.css');
     //bootstrap js
     cs()->registerScriptFile(bu() . '/libs/bootstrap/dist/js/bootstrap.min.js', CClientScript::POS_END);
 }
Exemplo n.º 9
0
 public static function buildLink($obj)
 {
     if ($obj->object_id) {
         return bu() . "/page?slug=post&id=" . $obj->object_id . "&pslug=" . $obj->object_slug;
     } else {
         return null;
     }
 }
Exemplo n.º 10
0
 public function run()
 {
     if (!user()->isGuest) {
         $this->renderContent();
     } else {
         user()->setFlash('error', t('Bạn cần đăng nhập để sử dụng tính năng này!'));
         Yii::app()->controller->redirect(bu() . '/sign-in');
     }
 }
Exemplo n.º 11
0
 /**
  * Returns the URL to the assets folder.Override to avoid publishing.
  * @return string the URL
  */
 public function getAssetsUrl()
 {
     if (isset($this->_assetsUrl)) {
         return $this->_assetsUrl;
     } else {
         $assetsUrl = bu() . '/yiibooster_assets';
         return $this->_assetsUrl = $assetsUrl;
     }
 }
Exemplo n.º 12
0
 function logout()
 {
     $CI =& get_instance();
     $ses = array();
     $ses['admin_logined'] = '';
     $ses['admin_hash'] = '';
     $CI->session->unset_userdata($ses);
     redirect(bu() . 'CI_lunit/login');
 }
Exemplo n.º 13
0
 public function run()
 {
     if (!user()->isGuest) {
         $this->renderContent();
     } else {
         user()->setFlash('error', t('You need to sign in before continue'));
         Yii::app()->controller->redirect(bu() . '/sign-in');
     }
 }
Exemplo n.º 14
0
/**
 * This is the shortcut to Yii::app()->clientScript->registerCssFile
 */
function regCssFile($files, $url = 'css', $addBaseUrl = true)
{
    if (!is_array($files)) {
        $files = array($files);
    }
    foreach ($files as $file) {
        $file = $addBaseUrl ? bu($url) . '/' . $file . '.css' : $url . '/' . $file . '.css';
        cs()->registerCssFile($file);
    }
}
Exemplo n.º 15
0
 protected function getAssetsUrl()
 {
     if (isset($this->_assetsUrl)) {
         return $this->_assetsUrl;
     } else {
         $assetsPath = Yii::getPathOfAlias('webroot.yiistrap_assets');
         $assetsUrl = bu() . '/yiistrap_assets';
         return $this->_assetsUrl = $assetsUrl;
     }
 }
Exemplo n.º 16
0
 private function completar_slug($pathInfo)
 {
     $slugs = array('programas/' . $pathInfo, 'especiales/' . $pathInfo, 'concursos/' . $pathInfo, 'documentales/' . $pathInfo, 'telemedellin/' . $pathInfo, 'recorrido-canal-parque/' . $pathInfo, '15-años-con-vos/' . $pathInfo);
     foreach ($slugs as $slug) {
         if ($this->verificar_slug($slug)) {
             Yii::app()->request->redirect(bu($slug), true, 301);
         }
     }
     return false;
 }
Exemplo n.º 17
0
 protected function renderContent()
 {
     if (isset($this->block) && $this->block != null) {
         $model = new UserRegisterForm();
         // if it is ajax validation request
         if (isset($_POST['ajax']) && $_POST['ajax'] === 'userregister-form') {
             echo CActiveForm::validate($model);
             Yii::app()->end();
         }
         // collect user input data
         if (isset($_POST['UserRegisterForm'])) {
             $model->attributes = $_POST['UserRegisterForm'];
             // validate user input password
             if ($model->validate()) {
                 $new_user = new User();
                 $new_user->scenario = 'create';
                 //$new_user->username=$model->username;
                 $new_user->username = $new_user->email = $model->email;
                 $new_user->display_name = $model->username;
                 $old_password = $new_user->password = $model->password;
                 //Create hash activation key
                 $new_user->user_activation_key = md5(time() . $new_user->username . USER_SALT);
                 if ($new_user->save()) {
                     //We will send mail for the user
                     $ses = new SimpleEmailService(ConstantDefine::AMAZON_SES_ACCESS_KEY, ConstantDefine::AMAZON_SES_SECRET_KEY);
                     $ses->enableVerifyHost(false);
                     $m = new SimpleEmailServiceMessage();
                     $m->addTo($new_user->email);
                     $m->setFrom(ConstantDefine::AMAZON_SES_EMAIL);
                     $m->setSubject('[' . SITE_NAME . '] Confirm your email at ' . SITE_NAME_URL);
                     $m_content = 'Hi ' . $new_user->display_name . '<br /><br />';
                     $m_content .= 'Welcome to ' . SITE_NAME . '! Please take a second to confirm ' . $new_user->email . ' as your email address by clicking this link: <br /><br />';
                     $link_content = FRONT_SITE_URL . '/user-activation/?key=' . $new_user->user_activation_key . '&user_id=' . $new_user->user_id;
                     $m_content .= '<a href="' . $link_content . '">' . $link_content . '</a><br /><br />';
                     $m_content .= 'Thank you for being with us!<br /><br />';
                     $m_content .= SITE_NAME . ' Team';
                     $m->setMessageFromString($m_content, $m_content);
                     $ses->sendEmail($m);
                     //Redirect to the Dashboard Page
                     $login_form = new UserLoginForm();
                     $login_form->username = $new_user->username;
                     $login_form->password = $old_password;
                     if ($login_form->login()) {
                         Yii::app()->controller->redirect(bu());
                     } else {
                         throw new CHttpException(503, t('Error while setting up your Account. Please try again later'));
                     }
                 }
             }
         }
         $this->render(BlockRenderWidget::setRenderOutput($this), array('model' => $model));
     } else {
         echo '';
     }
 }
Exemplo n.º 18
0
 private static function get_partial($partialName, $args = array(), $return_value = false)
 {
     extract($args);
     if ($return_value) {
         ob_start();
     }
     $path = bu("partials") . "/" . $partialName . ".php";
     include_once $path;
     if ($return_value) {
         return ob_get_clean();
     }
     return true;
 }
Exemplo n.º 19
0
 protected function getUrl($item)
 {
     if (!$item) {
         return false;
     }
     if (isset($item->tipo_link_id) && $item->tipo_link_id == 2) {
         $url = $this->parseExtUrl($item->url);
     } else {
         $u = Url::model()->findByPk($item->url_id);
         $url = bu($u->slug);
     }
     return $url;
 }
Exemplo n.º 20
0
 protected function renderContent()
 {
     if (isset($this->block) && $this->block != null) {
         $model = new UserRecoverPassForm();
         // if it is ajax validation request
         if (isset($_POST['ajax']) && $_POST['ajax'] === 'recoverpassword-form') {
             echo CActiveForm::validate($model);
             Yii::app()->end();
         }
         // collect user input data
         if (isset($_POST['UserRecoverPassForm'])) {
             $model->attributes = $_POST['UserRecoverPassForm'];
             // validate user input and redirect to the previous page if valid
             if ($model->validate()) {
                 //Find the user with the email
                 $user = User::model()->find('email=:email', array(':email' => $model->email));
                 if ($user) {
                     //Create a new password recover key
                     $key = md5(USER_RECOVER_PASS_SALT . time() . $user->username . $user->email);
                     $user->email_recover_key = $key;
                     if ($user->save()) {
                         $ses = new SimpleEmailService(ConstantDefine::AMAZON_SES_ACCESS_KEY, ConstantDefine::AMAZON_SES_SECRET_KEY);
                         $ses->enableVerifyHost(false);
                         $m = new SimpleEmailServiceMessage();
                         $m->addTo($user->email);
                         $m->setFrom(ConstantDefine::AMAZON_SES_EMAIL);
                         $m->setSubject('[' . SITE_NAME . '] Password reset instructions');
                         $m_content = 'Hi ' . $user->display_name . '<br /><br />';
                         $m_content .= 'A request to reset your ' . SITE_NAME . ' password has been made. If you did not make this request, simply ignore this email. If you did make this request, just click the link below:<br /><br />';
                         $link_content = FRONT_SITE_URL . '/reset-password/?key=' . $user->email_recover_key . '&user_id=' . $user->user_id;
                         $m_content .= '<a href="' . $link_content . '">' . $link_content . '</a><br /><br />';
                         $m_content .= 'If the URL above does not work, try copying and pasting it into your browser.<br /><br />';
                         $m_content .= 'If you continue to have problems, please feel free to contact us: <a href="mailto:' . ConstantDefine::SUPPORT_EMAIL . '">' . ConstantDefine::SUPPORT_EMAIL . '</a><br /><br />';
                         $m_content .= 'Thank you for being with us!<br /><br />';
                         $m_content .= SITE_NAME . ' Team';
                         $m->setMessageFromString($m_content, $m_content);
                         $ses->sendEmail($m);
                         user()->setFlash('success', 'Instructions to reset your password have been sent to you. Please check your email.');
                         Yii::app()->controller->redirect(bu() . '/sign-in');
                     }
                 } else {
                     user()->setFlash('error', 'Email is not existed');
                 }
             }
         }
         $this->render(BlockRenderWidget::setRenderOutput($this), array('model' => $model));
     } else {
         echo '';
     }
 }
Exemplo n.º 21
0
 public function render($class = false, $copy = false)
 {
     if (!is_array($this->_relacionados) || !count($this->_relacionados)) {
         return false;
     }
     $items = '';
     foreach ($this->_relacionados as $relacionado) {
         $items .= '<a href="' . bu($relacionado->url->slug) . '" class="relacionado"' . 'title="Ir a ' . str_replace('"', "'", $relacionado->nombre) . '">' . PHP_EOL . '<img src="' . bu('images/' . $relacionado->miniatura) . '" />' . PHP_EOL . '<p>' . $relacionado->nombre . '</p>' . PHP_EOL . '</a>' . PHP_EOL;
     }
     $head = '<h4>' . ($copy ? $copy : 'También te puede interesar...') . '</h4>' . PHP_EOL;
     $html = '<div id="relacionados"' . ($class ? ' class="' . $class . '"' : '') . '>' . PHP_EOL;
     $html .= $head;
     $html .= $items;
     $html .= '</div>' . PHP_EOL;
     return $html;
 }
Exemplo n.º 22
0
 protected function getUrl($item)
 {
     if (!$item) {
         return false;
     }
     switch ($item->tipo_link_id) {
         case 1:
             $u = Url::model()->findByPk($item->url_id);
             $url = bu($u->slug);
             break;
         case 2:
             $url = $this->parseExtUrl($item->url);
             break;
     }
     return $url;
 }
Exemplo n.º 23
0
 public function imageField($form, $model, $name, $id, $uname = '', $size = 150)
 {
     $html = '';
     $html .= $form->label($model, $name);
     //$html .= '<div class="col-sm-10">'.PHP_EOL;
     $html .= $form->hiddenField($model, $name, array('id' => $id . 'H'));
     $html .= '	<div class="controls imagen">' . PHP_EOL;
     $html .= '		<div id="' . $name . $uname . '">' . PHP_EOL;
     $html .= '		<!-- Mensaje cuando el Javascript se encuentra deshabilitado -->' . PHP_EOL;
     $html .= '		<noscript>Debes tener habilitado Javascript en tu navegador</noscript>' . PHP_EOL;
     $html .= '		<!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload -->' . PHP_EOL;
     $html .= '		<div class="row fileupload-buttonbar">' . PHP_EOL;
     $html .= '			<div class="col-sm-4">' . PHP_EOL;
     $html .= '			<!-- The fileinput-button span is used to style the file input field as button -->' . PHP_EOL;
     $html .= '				<span class="btn btn-success fileinput-button">' . PHP_EOL;
     $html .= '					<span>Añadir archivo</span> ' . PHP_EOL;
     $html .= '					<i class="fa fa-plus"></i>' . PHP_EOL;
     $html .= '					<input id="' . $id . '" type="file" name="' . $id . '[]">' . PHP_EOL;
     $html .= '				</span>              ' . PHP_EOL;
     //$html .= '				<span class="fileupload-loading"></span>'.PHP_EOL;
     $html .= '			</div>' . PHP_EOL;
     if ($model->{$name} != '') {
         $html .= '			<div class="col-sm-8 actual">' . PHP_EOL;
         $html .= '				<blockquote><span>Actual</span>' . PHP_EOL;
         $html .= '				<span><img src="' . bu('images/' . $model->{$name}) . '" width="' . $size . '" /></span></blockquote>' . PHP_EOL;
         $html .= '			</div>' . PHP_EOL;
     }
     $html .= '			<!-- The global progress information -->' . PHP_EOL;
     $html .= '			<div class="col-sm-12 fileupload-progress fade">' . PHP_EOL;
     $html .= '				<!-- The global progress bar -->' . PHP_EOL;
     $html .= '				<div class="progress progress-success progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100">' . PHP_EOL;
     $html .= '				<div class="bar" style="width:0%;"></div>' . PHP_EOL;
     $html .= '			</div>' . PHP_EOL;
     $html .= '			<!-- The extended global progress information -->' . PHP_EOL;
     $html .= '			<div class="progress-extended">&nbsp;</div>' . PHP_EOL;
     $html .= '		</div>' . PHP_EOL;
     $html .= '	</div>' . PHP_EOL;
     $html .= '	<!-- The table listing the files available for upload/download -->' . PHP_EOL;
     $html .= '	<table role="presentation" class="table table-striped">' . PHP_EOL;
     $html .= '		<tbody class="files" data-toggle="modal-gallery" data-target="#modal-gallery"></tbody>' . PHP_EOL;
     $html .= '	</table>' . PHP_EOL;
     $html .= '	</div>' . PHP_EOL;
     //$html .= '	</div>'.PHP_EOL;
     $html .= '</div>' . PHP_EOL;
     return $html;
 }
Exemplo n.º 24
0
 protected function renderContent()
 {
     if (isset($this->block) && $this->block != null) {
         if (isset($_GET['key']) && $_GET['user_id']) {
             $key = $_GET['key'];
             $user_id = (int) $_GET['user_id'];
             //Find the user
             $user = User::model()->findByPk($user_id);
             if ($user && $user->email_recover_key != '') {
                 $model = new UserResetPasswordForm();
                 // if it is ajax validation request
                 if (isset($_POST['ajax']) && $_POST['ajax'] === 'resetpassword-form') {
                     echo CActiveForm::validate($model);
                     Yii::app()->end();
                 }
                 // collect user input data
                 if (isset($_POST['UserResetPasswordForm'])) {
                     $model->attributes = $_POST['UserResetPasswordForm'];
                     // validate user input and redirect to the previous page if valid
                     if ($model->validate()) {
                         $user->email_recover_key = '';
                         $user->salt = USER_SALT;
                         $user->password = User::model()->hashPassword($model->password, USER_SALT);
                         if ($user->save()) {
                             user()->setFlash('success', 'Your password has been reset.');
                             Yii::app()->controller->redirect(bu() . '/sign-in');
                         }
                     }
                 }
                 $this->render(BlockRenderWidget::setRenderOutput($this), array('model' => $model));
             } else {
                 Yii::app()->controller->redirect(bu() . '/sign-in');
             }
         } else {
             Yii::app()->controller->redirect(bu() . '/sign-in');
         }
     } else {
         echo '';
     }
 }
Exemplo n.º 25
0
 public function actionIndex()
 {
     $id = Yii::app()->user->id;
     if (!$id) {
         $this->redirect(bu('/usuario'));
     }
     $usuario_cruge = Yii::app()->user->um->loadUserById($id);
     $usuario = Usuario::model()->findByAttributes(array('cruge_user_id' => $id));
     if (!$usuario || !$usuario_cruge) {
         $this->redirect(array('/usuario'));
     }
     $registroForm = new RegistroForm();
     $this->performAjaxValidation($registroForm);
     $registroForm->scenario = 'update';
     if (isset($_POST['RegistroForm'])) {
         $registroForm->attributes = $_POST['RegistroForm'];
         if ($registroForm->validate()) {
             if ($usuario->guardar_datos_usuario($usuario_cruge, $registroForm)) {
                 Yii::app()->user->setFlash('success', "Los cambios se guardaron exitosamente");
                 $this->redirect(array('/usuario/perfil'));
             } else {
                 Yii::app()->user->setFlash('error', "No se pudieron guardar los cambios");
                 Yii::log('No se pudieron guardar los cambios', 'error');
             }
         } else {
             Yii::log('No se validaron los datos enviados', 'error');
         }
     } else {
         $registroForm->correo = $usuario_cruge->email;
         $registroForm->attributes = $usuario->getAttributes();
     }
     //if(isset($_POST['RegistroForm']))
     if ($usuario->nacimiento) {
         $registroForm->anio = date('Y', strtotime($usuario->nacimiento));
         $registroForm->mes = date('m', strtotime($usuario->nacimiento));
         $registroForm->dia = date('d', strtotime($usuario->nacimiento));
     }
     $fondo_pagina = 'backgrounds/generica-interna-1.jpg';
     $this->render('index', array('model' => $registroForm, 'usuario' => $usuario, 'fondo_pagina' => $fondo_pagina));
 }
Exemplo n.º 26
0
 protected function renderContent()
 {
     if (isset($this->block) && $this->block != null) {
         $model = new UserLoginForm();
         // if it is ajax validation request
         if (isset($_POST['ajax']) && $_POST['ajax'] === 'login-form') {
             echo CActiveForm::validate($model);
             Yii::app()->end();
         }
         // collect user input data
         if (isset($_POST['UserLoginForm'])) {
             $model->attributes = $_POST['UserLoginForm'];
             // validate user input and redirect to the previous page if valid
             if ($model->validate() && $model->login()) {
                 Yii::app()->controller->redirect(bu() . '/dashboard');
             }
         }
         $this->render(BlockRenderWidget::setRenderOutput($this), array('model' => $model));
     } else {
         echo '';
     }
 }
Exemplo n.º 27
0
 protected function renderContent()
 {
     if (isset($this->block) && $this->block != null) {
         $user_id = (int) $_GET['user_id'];
         $key = $_GET['key'];
         //Find the User
         $user = User::model()->findByPk($user_id);
         if ($user) {
             if ($user->confirmed == 0) {
                 //Ok We will check the key here
                 if ($user->user_activation_key == $key) {
                     $user->confirmed = 1;
                     if ($user->save()) {
                         user()->setFlash('success', 'You have confirmed your account! Please sign in to coninue');
                         Yii::app()->controller->redirect(bu() . '/sign-in');
                     }
                 }
             }
         }
         throw new CHttpException('503', 'Wrong Link');
     }
     Yii::app()->end();
 }
Exemplo n.º 28
0
 public function run()
 {
     $tabs = array();
     foreach (param('translatedLanguages') as $l => $lang) {
         if (app()->sourceLanguage === $l) {
             $suffix = '';
         } else {
             $suffix = '_' . $l;
         }
         switch ($this->type) {
             case TbInput::TYPE_TEXT:
                 $content = $this->form->textFieldRow($this->model, $this->attribute . $suffix, array('style' => 'margin-bottom:1px;', 'class' => $this->block ? 'input-block-level' : ''));
                 break;
             case TbInput::TYPE_REDACTOR:
                 $content = $this->form->redactorRow($this->model, $this->attribute . $suffix, array('editorOptions' => array('buttons' => array('html', 'bold', 'italic', '|', 'unorderedlist', 'orderedlist', 'outdent', 'indent', '|', 'image', 'video', '|', 'link', 'alignment', 'horizontalrule', 'formatting', 'table'), 'imageGetJson' => url('/admin/media/json'), 'predefinedLinks' => url('/admin/page/json'), 'minHeight' => '300', 'removeEmptyTags' => false, 'convertDivs' => false, 'removeEmptyTags' => false, 'iframe' => true, 'linebreaks' => true, 'css' => array(bu('css/style.css'), bu('css/red_fix.css')), 'formattingTags' => array('h1', 'h2', 'h3', 'h4', 'p', 'span'))));
                 break;
             default:
                 throw new CException(__CLASS__ . ': Failed to run widget! Type is invalid.');
                 break;
         }
         $tabs[] = array('label' => $l, 'content' => $content, 'active' => app()->sourceLanguage === $l, 'linkOptions' => array('style' => 'padding:3px 6px;font-size:12px;line-height:12px;'));
     }
     $this->controller->widget('bootstrap.widgets.TbTabs', array('tabs' => $tabs, 'type' => 'pills', 'placement' => 'below'));
 }
Exemplo n.º 29
0
</li>
		  <?php 
if (Yii::app()->user->checkAccess('editar_menu_items')) {
    ?>
		  <li><?php 
    echo l('<span class="glyphicon glyphicon-pencil"></span> Editar', bu('administrador/menu/updateitem/' . $model->id));
    ?>
</li>
		  <?php 
}
?>
		  <?php 
if (Yii::app()->user->checkAccess('eliminar_menu_items')) {
    ?>
		  <li><?php 
    echo l('<small><span class="glyphicon glyphicon-remove"></span> Eliminar</small>', bu('administrador/menuitem/delete/' . $model->id), array('onclick' => 'if( !confirm(¿"Seguro que desea borrar el item "<?php echo $model->label; ?>") ) {return false;}'));
    ?>
</li>
		  <?php 
}
?>
		</ul>
	</div>
	<div class="col-sm-10">
		<h1>Item <?php 
echo $model->label;
?>
</h1>
		<?php 
foreach (Yii::app()->user->getFlashes() as $key => $message) {
    echo '<div class="flash-' . $key . ' alert alert-info">' . $message . "</div>\n";
Exemplo n.º 30
0
<div class="row">
	<?php 
if (Yii::app()->user->checkAccess('crear_album_fotos')) {
    ?>
	<div class="col-sm-12">
        <div class="nav navbar-right btn-group">
            <?php 
    echo l('<i class="fa fa-plus"></i> Agregar álbum de fotos', $this->createUrl('albumfoto/crear', array('id' => $model->id)), array('class' => 'btn btn-primary'));
    ?>
        </div>
    </div>
	<?php 
}
?>
	<?php 
if ($fotos->getData()) {
    ?>
	<div class="col-sm-12">
	<?php 
    $this->widget('zii.widgets.grid.CGridView', array('dataProvider' => $fotos, 'enableSorting' => true, 'pager' => array('pageSize' => 25), 'htmlOptions' => array('style' => 'clear:both;'), 'columns' => array(array('name' => 'nombre', 'type' => 'html', 'value' => '$data->nombre . " <span class=\\"badge bg-olive\\">" . count($data->fotos) . "</span>"'), array('name' => 'url_id', 'type' => 'html', 'value' => 'l("<i class=\\"fa fa-external-link\\"></i> ' . $model->url->slug . '" . $data->url->slug, "' . bu($model->url->slug) . '" . $data->url->slug, array("target" => "_blank"))'), array('name' => 'estado', 'filter' => array('' => 'Todos', '1' => 'Publicado', '0' => 'Desactivado'), 'value' => '($data->estado=="1")?("Publicado"):("Desactivado")'), array('name' => 'destacado', 'filter' => array('' => 'Todos', '1' => 'Sí', '0' => 'No'), 'value' => '($data->destacado=="1")?("Sí"):("No")'), array('class' => 'CButtonColumn', 'template' => '{view} | {update} | {delete}', 'buttons' => array('view' => array('url' => 'Yii::app()->createUrl("administrador/albumfoto/view", array("id"=>$data->id))', 'visible' => '(Yii::app()->user->checkAccess("ver_album_fotos"))?true:false', 'imageUrl' => false, 'label' => '<i class="fa fa-search"></i>', 'options' => array('title' => 'Ver detalles')), 'update' => array('url' => 'Yii::app()->createUrl("administrador/albumfoto/update", array("id"=>$data->id))', 'visible' => '(Yii::app()->user->checkAccess("editar_album_fotos"))?true:false', 'imageUrl' => false, 'label' => '<i class="fa fa-pencil"></i>', 'options' => array('title' => 'Editar')), 'delete' => array('url' => 'Yii::app()->createUrl("administrador/albumfoto/delete", array("id"=>$data->id))', 'visible' => '(Yii::app()->user->checkAccess("eliminar_album_fotos"))?true:false', 'imageUrl' => false, 'label' => '<i class="fa fa-trash-o"></i>', 'options' => array('title' => 'Eliminar')))))));
    ?>
	</div>
<?php 
}
?>
</div>