/** * Initialize css. */ public static function css() { $cs = Yii::app()->getClientScript(); // main css $cs->registerCssFile(Yii::app()->request->baseUrl . '/static/css/main.css'); // 960 css $cs->registerCssFile(Yii::app()->request->baseUrl . '/static/css/960.css'); // all jquery plugins css //$cs->registerCssFile(Yii::app()->request->baseUrl.'/static/css/jquery-1.3.x.plugins.css'); // jquery-ui if (MParams::getRegisterJqueryUI() && MPath::interfaceExists(MParams::getInterface())) { $cs->registerCssFile(Yii::app()->request->baseUrl . '/static/css/ui/' . MParams::getInterface() . '/jquery-ui-' . MParams::jqueryUIVersion . '.custom.css'); } // use this css if you want to globally redefine jquery-ui css framework classes $redefineJqueryUI = dirname(Yii::app()->basePath) . DIRECTORY_SEPARATOR . 'static' . DIRECTORY_SEPARATOR . 'css' . DIRECTORY_SEPARATOR . 'ui.css'; if (file_exists($redefineJqueryUI) && filesize($redefineJqueryUI) !== 0) { $cs->registerCssFile(Yii::app()->request->baseUrl . '/static/css/ui.css'); } }
/** * Register a new member account. * If creation is successful, the browser will be redirected to the 'login' page. */ public function actionRegister() { $model = new User($this->action->id); // collect user input data if (isset($_POST['User'])) { // collect user input data $model->attributes = $_POST['User']; // instantiate a new user details object $model->details = new UserDetails($this->action->id); $model->details->emailConfirmationKey = $model->details->generateConfirmationKey(); if (isset($_POST['UserDetails'])) { $model->details->attributes = $_POST['UserDetails']; } // validate with the current action as scenario if (($validated = $model->validate()) !== false) { // if user is logged in if (!Yii::app()->user->isGuest) { // if you place this code before validate() then verifyCode will be invalid // log user out from the current account Yii::app()->user->logout(); if (!Yii::app()->getSession()->getIsStarted()) { // restore http session. this is necessary for user flash messages Yii::app()->getSession()->open(); } } // create user record (without validation) if (($saved = $model->save(false)) !== false) { // save user details record $model->details->userId = $model->id; if ($model->details->save(false) === false) { // hmmm, what could be the problem? Yii::log(W3::t('system', 'Failed creating UserDetails record. Member ID: {userId}. Method called: {method}.', array('{userId}' => $model->id, '{method}' => __METHOD__ . '()')), 'error', 'w3'); } // set success message MUserFlash::setTopSuccess(Yii::t('hint', '{screenName}, your member account has been successfully created.', array('{screenName}' => MHtml::wrapInTag($model->screenName, 'strong')))); // send welcome email $headers = "From: " . MParams::getAdminEmailAddress() . "\r\nReply-To: " . MParams::getAdminEmailAddress(); $content = Yii::t('email', 'Content(New member account)', array('{siteTitle}' => MParams::getSiteTitle(), '{screenName}' => $model->screenName, '{emailConfirmationKey}' => $model->details->emailConfirmationKey, '{emailConfirmationLink}' => Yii::app()->createAbsoluteUrl($this->id . '/confirmEmail', array('email' => $model->email, 'key' => $model->details->emailConfirmationKey)))); $sent = @mail($model->email, Yii::t('email', 'New member account'), $content, $headers); // log email Yii::log($model->email . ' ' . "\t" . 'New member account', $sent ? 'sent' : 'not-sent', 'email'); Yii::log($model->email . "\n" . 'Subject: New member account' . "\n" . 'Content: ' . $content . "\n" . 'Headers: ' . $headers, $sent ? 'sent' : 'not-sent', 'email-details'); // go to login page $this->redirect($this->getGotoUrl()); } } } else { // pre-assigned attributes (default values for a new record) $model->screenNameSame = true; $model->language = MParams::getLanguage(); $model->interface = MParams::getInterface(); } if (!Yii::app()->user->isGuest) { // warn user if already logged in MUserFlash::setTopInfo(Yii::t('hint', '{screenName}, this action will log you out from your current account.', array('{screenName}' => MHtml::wrapInTag(Yii::app()->user->screenName, 'strong')))); } if (!isset($model->details)) { // new associated user details $model->details = new UserDetails($this->action->id); } // render the view file $this->render($this->action->id, array('model' => $model)); }
/** * Generate css classes for html's tag "body". * <body class="_return_"> * @return string */ public static function getBodytagCssClass() { $c = array(); if (MParams::getHtmlDoctype() === 'transitional') { $c['doctype'] = 'w3-doctype-transitional'; } else { if (MParams::getHtmlDoctype() === 'strict') { $c['doctype'] = 'w3-doctype-strict'; } } if (!self::hasContent() && !self::hasSidebar1() && !self::hasSidebar2()) { ($c['column'] = 'w3-layout-zero-column') && ($c['columnD'] = 'w3-layout'); } else { if (self::hasContent() && !self::hasSidebar1() && !self::hasSidebar2()) { ($c['column'] = 'w3-layout-one-column') && ($c['columnD'] = 'w3-layout-content'); } else { if (!self::hasContent() && self::hasSidebar1() && !self::hasSidebar2()) { ($c['column'] = 'w3-layout-one-column') && ($c['columnD'] = 'w3-layout-sidebar1'); } else { if (!self::hasContent() && !self::hasSidebar1() && self::hasSidebar2()) { ($c['column'] = 'w3-layout-one-column') && ($c['columnD'] = 'w3-layout-sidebar2'); } else { if (self::hasContent() && self::hasSidebar1() && !self::hasSidebar2()) { ($c['column'] = 'w3-layout-two-column') && ($c['columnD'] = 'w3-layout-sidebar1-content'); } else { if (!self::hasContent() && self::hasSidebar1() && self::hasSidebar2()) { ($c['column'] = 'w3-layout-two-column') && ($c['columnD'] = 'w3-layout-sidebar1-sidebar2'); } else { if (self::hasContent() && !self::hasSidebar1() && self::hasSidebar2()) { ($c['column'] = 'w3-layout-two-column') && ($c['columnD'] = 'w3-layout-content-sidebar2'); } else { if (self::hasContent() && self::hasSidebar1() && self::hasSidebar2()) { ($c['column'] = 'w3-layout-three-column') && ($c['columnD'] = 'w3-layout-sidebar1-content-sidebar2'); } } } } } } } } $c['controller'] = 'w3-controller-' . Yii::app()->controller->id; $c['controllerAction'] = $c['controller'] . '-' . Yii::app()->controller->action->id; $c['interface'] = 'w3-interface-' . MParams::getInterface(); return implode(' ', $c); }