admin

Categories:

alt
Name: Facebook
Parent: Social
Posts: 2
alt
Name: Tumblr
Parent: Social
Posts: 1
alt
Name: Ubuntu
Parent: Linux
Posts: 13
alt
Name: Linux
Parent: No category
Posts: 1
alt
Name: Content
Parent: No category
Posts: 2
alt
Name: Google Chrome
Parent: Google
Posts: 1
alt
Name: YouTube
Parent: Social
Posts: 1
alt
Name: Composer
Parent: No category
Posts: 4
alt
Name: Codeigniter
Parent: Framework
Posts: 1
alt
Name: Laravel
Parent: Framework
Posts: 5
alt
Name: Notepad++
Parent: IDE
Posts: 1
alt
Name: XAMPP
Parent: Server
Posts: 2
alt
Name: NetBeans
Parent: IDE
Posts: 3
alt
Name: Google Maps API
Parent: Google
Posts: 1
alt
Name: iPage.com
Parent: Hosting
Posts: 1
alt
Name: DHTMLX
Parent: No category
Posts: 1
alt
Name: Git, Git Bash
Parent: No category
Posts: 1
alt
Name: Command line CMD
Parent: No category
Posts: 1
alt
Name: PhpStorm
Parent: IDE
Posts: 2
alt
Name: ApiOK
Parent: Social
Posts: 1

Posts:

Displaying 81-90 of 271 results.
Wiki: Bootstrap CSS Style colors classeswiki
posted by admin on October 12, 2016
Text
Add meaning through text-colors with the classes below. Links will darken on hover:
Class Description

.text-muted Text styled with class "text-muted"
.text-primary Text styled with class "text-primary"
.text-success Text styled with class "text-success"
.text-info Text styled with class "text-info"
.text-warning Text styled with class "text-warning"
.text-danger Text styled with class "text-danger"

Background
Add meaning through background-colors with the classes below. Links will darken on hover just like text classes:
Class Description

.bg-primary Table cell is styled with class "bg-primary"
.bg-success Table cell is styled with class "bg-success"
.bg-info Table cell is styled with class "bg-info"
.bg-warning Table cell is styled with class "bg-warning"
.bg-danger Table cell is styled with class "bg-danger"
Read more
Resolved: Yii 1.1 Relation to same model relations HAS_MANY BELONGS_TO error
posted by admin on October 12, 2016
I have this error
Trying to get property of non-object
php code

($model->creator_id) ? $model->creator->firstname . ' ' . $model->creator->lastname : 'Нет',

model relations:

public function relations()
{
// NOTE: you may need to adjust the relation name and the related
// class name for the relations automatically generated below.
return array(
'creator' => array(self::BELONGS_TO, 'User', 'creator_id'),
'creator' => array(self::HAS_MANY, 'User', 'creator_id'),
);
}
Read more
Resolved: Yii 1.1 How to get attribute from model attributeLabels function in CDetailView custom field
posted by admin on October 12, 2016
I have this CDetailView

<?php $this->widget('zii.widgets.CDetailView', array(
'data'=>$model,
'attributes'=>array(
'id',
'username',
'personal_email',
'work_email',
array(
'label' => Yii::t('translation', 'Created'),
'type' => 'raw',
'value' => app::datetimeUserFriendly($model->created),
),
'updated',
. . .
),
)); ?>

I want to read label from model attributeLabels.Read more
Resolved: PHP datetime to russian user friendly format converting. Дата и время на русский на дружественный вид
posted by admin on October 12, 2016
I have datetime from databse MySQL, in format
2016-10-10 12:34:33

By PHP datetime formats I can have string like this
07 October 2016, 04:11, Friday

But I want the3 same output, but in russian
07 Октября 2016, 04:11, ПятницаRead more
Wiki: Yii 1.1 Cgridview TextField Search and Filter of a relations field without errorswiki
posted by admin on October 11, 2016
1) Add some public attribute to the model.

class Customer extends CActiveRecord
{
public $customername; // for firstname + lastname;
....

2) Declare it safe on search.

public function rules()
{
return array(
....
array('id, firstname, lastname, ...., customername', 'safe', 'on'=>'search'),
);
}

3) Set the label for it.

public function attributeLabels()
{
return array(
'id' => 'ID',
'firstname' => 'First Name',
'lastname' => 'Last Name',
....
'customername' => 'Customer Name',
);
}

4) Add a search condition for it in "search()" method.

public function search()
{
$criteria=new CDbCriteria;

$criteria->compare('id',$this->id);
$criteria->compare('firstname',$this->firstname);
$criteria->compare('lastname',$this->lasttname);
....
if ( $this->customername != "" )
{
$crit2 = new CDbCriteria;
$crit2->compare('firstname', $this->customername , true, 'OR');
$crit2->compare('lastname', $this->customername , true, 'OR');
$criteria->mergeWith($crit2);
}
....

5) Add the sorting rule for it, also in the "search()" method.

....
return new CActiveDataProvider(get_class($this), array(
'criteria' => $criteria,
'sort' => array(
'defaultOrder' => 'lastname, firstname',
'attributes' => array(
'customername' => array(
'asc' => 'lastname, firstname',
'desc' => 'lastname DESC, firstname DESC',
),
'*',
),
),
'pagination' => array(
'pageSize' => 20,
),
));

6) And use the attribute in the grid.

$this->widget('zii.widgets.grid.CGridView', array(
'id' => 'customer-grid',
'dataProvider' => $model->search(),
'filter' => $model,
'columns' => array(
....
array(
'name' => 'customername',
'value' => '$data->firstname . " " . $data->lastname',
),
....
Read more
Resolved: Yii 1.1 Cmenu item url array working by wrong logic
posted by admin on October 11, 2016
Cmenu item url working not correct.
It take my current url and the compose new url, and it is wrong.
For example it looks like like this

http://bukivedi.store/index.php?r=stores/stores/user

But I have only module Stores and want to view result:

http://bukivedi.store/index.php?r=stores/user

My Cmenu array is here:

array('label'=>'Таблицы <span class="caret"></span>', 'url'=>array('#'),
'itemOptions'=>array('class'=>'dropdown'),
'linkOptions'=> array(
'class' => 'dropdown-toggle',
'data-toggle' => 'dropdown',
),
'items' => array(
array('label' => 'Пользователи', 'url' => array('stores/user')),
array('label' => '', 'url' => array('#'), 'itemOptions'=>array('role'=>'separator', 'class'=>'divider')),
),
),
Read more
Resolved: Yii 1.1 How to add html tag in CMenu menu item label text?
posted by admin on October 10, 2016
I have CMenu and I try to add html tags to menu items label and like this

<?php $this->widget('zii.widgets.CMenu',array(
'htmlOptions'=>array('class'=>'nav navbar-nav'),
'items'=>array(
array('label'=>'Главная', 'url'=>array('/')),
array('label'=>'Склады <span class="caret"></span>', 'url'=>array('#'),
'itemOptions'=>array('class'=>'dropdown'),
'linkOptions'=> array(
'class' => 'dropdown-toggle',
'data-toggle' => 'dropdown',
),
...
),
)); ?>

Output show encoded html with html character:

Склады <span class="caret"></span>
Read more
Resolved: Yii 1.1 yii alias module is invalid
posted by admin on October 10, 2016
I had module
store
After renaming it to stores.
in controller StoreModule to StoresModule and in main.php min modules array store to stores
I have got this error

Alias "stores.StoresModule" is invalid. Make sure it points to an existing PHP file and the file is readable.
Read more
Resolved: Yii 1: Uncaught TypeError: jQuery(...).yiiactiveform is not a function
posted by admin on October 10, 2016
In form pages I have got an error like this

Yii 1: Uncaught TypeError: jQuery(...).yiiactiveform is not a function

Form:

<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'login-form',
'enableClientValidation'=>true,
'clientOptions'=>array(
'validateOnSubmit'=>true,
),
)); ?>
...
<?php $this->endWidget(); ?>

head:

...
<?php Yii::app()->clientScript->registerScriptFile(app::baseUrl(false, "/js/", "jquery-1.9.1.min.js"), CClientScript::POS_HEAD);?>
...

Warning:
app::baseUrl(false, "/js/", "jquery-1.9.1.min.js") - it is my function and class, repace it by Yii baseURL propertyRead more
Wiki: Yii 1: Как задавать стили css (class, id) для CMenu, пунктов меню и ссылок в менюwiki
posted by admin on October 10, 2016
Часто хочется задать свои стили css, своё оформление для меню CMenu. Это сводится к добавлению классов и идентификаторов id в html (виджет Cmenu формирует ненумерованный список <ul>, <li>;). В Yii для этих целей предусмотрены htmlOptions, itemOptions, and linkOptions.
1. Добавление названий id и class к CMenu.
Используются id и htmlOptions для добавления своих идентификаторов и классов.

//in your view
$this->widget('zii.widgets.CMenu', array(
'id'=>'myMenu',
'items'=>$this->myMenu,
'htmlOptions'=>array('class'=>'span-24 last'),
'encodeLabel'=>false, // чтобы можно было в label использовать html-теги (жирность, наклон, цвет и т.д.)
));

Это сформирует следующий html:

<ul class="span-24 last" id="myMenu">
...
</ul>

2. Добавление названий классов (class names) к пунктам CMenu (CMenu items) и ссылкам в пунктах меню (CMenu item links).
Используем itemOptions и linkOptions. Например:

//in your controller
$this->myMenu = array(
'id'=>'myMenu',
'items'=>array(
array(
'label'=>'Home',
'url'=>array('site/index'),
'itemOptions'=>array('class'=>'visited'),
'linkOptions'=>array('class'=>'bar'),
),
array('label'=>'Sign Out', 'url'=>array('site/signout')),
),
);

Эти команды позволят Yii сгенерировать следующий кусочек меню:

...
<ul id="myMenu">
<li class="visited">
<a class="bar" href="/site/index">Home</a>
</li>
...

Установив таким образом идентификаторы и классы в шаблоне html, далее расписывайте в файле стилей .css соответствующее оформление для них.Read more