-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
0.1beta-1 is releassed
- Loading branch information
quot;brussens
committed
Mar 13, 2014
1 parent
3e58c94
commit 22c5d29
Showing
29 changed files
with
847 additions
and
548 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
/** | ||
* Описание: Базовый контроллер модуля Message | ||
*/ | ||
|
||
class BaseController extends \yupe\components\controllers\FrontController { | ||
public function init() { | ||
if (!Yii::app()->user->isAuthenticated()) { | ||
$this->redirect(array('/user/account/login')); | ||
} | ||
Yii::app()->clientScript->registerCssFile( | ||
Yii::app()->assetManager->publish( | ||
Yii::getPathOfAlias('application.modules.message.views.assets.css').'/messageModule.css' | ||
) | ||
); | ||
return parent::init(); | ||
} | ||
/** | ||
* Обрезка строк | ||
*/ | ||
public function toCut($str,$len=100,$div=" ") { | ||
//Обрезка Строки до заданной максимальной длинны, с округлением до посленего символа - разделителя (в меньшую сторону) | ||
//например toCut('Мама мыла раму',14," ") вернет "Мама мыла" | ||
if (strlen($str)<=$len){ | ||
return $str; | ||
} | ||
else{ | ||
$str=substr($str,0,$len); | ||
$pos=strrpos($str,$div); | ||
$str=substr($str,0,$pos); | ||
return $str.' ...'; | ||
} | ||
} | ||
} |
Oops, something went wrong.