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
<?php | |
echo !empty($model-><field>) && file_exists(Yii::getPathOfAlias('webroot.images')."<PATH>".$model-><field>) ? CHtml::image(Yii::app()->baseurl."<PATH>".$model-><field>,"",array("style"=>"width:50px;height:50px;align:center;")) : CHtml::image(Yii::app()->baseurl."/<PATH>/no_img.png","",array("style"=>"width:50px;height:50px;align:center;")); | |
?> |
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
<?php | |
// Add to current model | |
protected function beforeDelete() | |
{ | |
if (parent::beforeDelete()) { | |
// file_field_name - db field that contains name of uploaded file | |
if ($this-><file_field_name>) | |
// webroot.images - path to images forlder (such as Yii::app()->baseurl."/images/") | |
// if using another forder name (for example: /upload/) - Yii::getPathOfAlias('webroot.upload') | |
@unlink(Yii::getPathOfAlias('webroot.images') . "DIRECTOTY_SEPARATOR" . $this-><file_field_name>); |
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
<? | |
// There and next: | |
// webroot.images - path to images forlder (such as Yii::app()->baseurl."/images/") | |
// if using another forder name (for example: /upload/) - Yii::getPathOfAlias('webroot.upload') | |
// file_field_name - db field that contains name of uploaded file | |
// DIRECTORY_SEPARATOR - separator, such as "/" or included folders | |
// PATH_TO_IMAGE_FOLDER - full path to folder with images | |
// Previously added CImageHandler and Fancybox extensions | |
// CImageHandler: |
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
<?php | |
// Used TbGridView, if Bootstrap extension isn't used - use CGridview | |
// <grid-id> - id of grid (must be changed) | |
$this->widget('bootstrap.widgets.TbGridView',array( | |
'id'=>'<grid-id>', | |
'dataProvider'=>$model->search(), | |
'filter'=>$model, | |
'columns'=>array( | |
// number rows | |
array( |
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
<?php | |
// There and next: | |
// ids - the id's of GridView's checkbox column | |
// <grid-id> - the id's of GridView | |
// View code | |
$this->widget('bootstrap.widgets.TbButton', array( | |
'label'=>'Удалить', | |
'type'=>'danger', |
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
<?php | |
$this->widget('bootstrap.widgets.TbButton', array( | |
'label'=>'<ButtonName>', | |
'type'=>'ButtonType', | |
'buttonType'=>'ajaxButton', | |
'encodeLabel'=>true, | |
'url'=>Yii::app()->createUrl('/<module>/<controller>/<action>'), | |
'ajaxOptions'=>array( | |
// Method - POST (for $_POST requests) or GET (for $_GET requests) |
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
<!-- From Menu | |
In layouts/main.php to section "url" of "items" add: --> | |
<?php | |
'url'=>array(''.Yii::app()->request->requestUri.'#id_div' | |
?> |
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
# SSH-session | |
# Install Composer to /bin directory | |
php -r "readfile('https://getcomposer.org/installer');" | php -- --filename=composer --install-dir=/bin | |
# Install composer plugin to work with Bower | |
composer global require "fxp/composer-asset-plugin:~1.0.0" | |
// Go to www-folder | |
cd /www-folder |
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
/****** | |
SELECT * INTO [db_name].[db_prefix].[new_table_name] FROM [db_name].[db_prefix].[old_table_name] | |
Example: | |
******/ | |
SELECT * INTO [test].[dbo].[VRD_CarSaleContractFilePathNew] FROM [test].[dbo].[VRD_CarSaleContractFilePath] |
OlderNewer