Yii

Using find() in Active Record with multiple where clause

自闭症网瘾萝莉.ら 提交于 2019-12-23 12:00:03
问题 I want to divide (using brackets) following Active Record query in 3 groups. First group would be from first "Where" clause to last "orWhere". Second and third would be using "andWhere". Please give me suggestions about how can I use brackets to separate all 3 sections. $query = Book::find() ->where('book_name LIKE :book_name', array(':book_name' => '%'.$book_name.'%')) ->orWhere('book_category LIKE :book_category', array(':book_category' =>'%'.$category.'%')) ->orWhere('finance_subcategory

Yii framework : role based access control

不想你离开。 提交于 2019-12-23 10:29:13
问题 I am implementing role based access control using yii framework for the application mentioned in the Agile web application development using yii framework book.I have implemented every thing up to page number 189. page number 189 says that following method can be used to check whether user is allowed to perform some action or not. If( Yii::app()->user->checkAccess('createIssue')) { //perform needed logic } but this method always return false for users who have been assigned to createIssue

Yii framework : role based access control

和自甴很熟 提交于 2019-12-23 10:26:56
问题 I am implementing role based access control using yii framework for the application mentioned in the Agile web application development using yii framework book.I have implemented every thing up to page number 189. page number 189 says that following method can be used to check whether user is allowed to perform some action or not. If( Yii::app()->user->checkAccess('createIssue')) { //perform needed logic } but this method always return false for users who have been assigned to createIssue

Non-Editable Text-Field

早过忘川 提交于 2019-12-23 09:29:54
问题 I am new in YII , i am wondering if the text-field in YII can made non-editable. If so can anyone answer. I do the following way.. <?php echo $form->labelEx($model,'first_name'); ?> <?php echo $form->textField($model,'first_name',array('setEnabled' => false)); ?> This is not working. 回答1: Use readonly instead: <?php echo $form->textField($model,'first_name',array('readonly' => true)); ?> For no blinking, go for disabled attribute: <?php echo $form->textField($model,'first_name',array(

Create URL in Yii with element name with # [closed]

非 Y 不嫁゛ 提交于 2019-12-23 08:57:09
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . I need to create URLs in Yii with specifying a div on the page to focus when clicked... I know I need to put the div name with # in the URL, but how do I specify that in createUrl function of Yii... The createUrl

Yii: requiring a .php file

試著忘記壹切 提交于 2019-12-23 07:31:38
问题 I develop a project with Yii. I need to require a plain .php file (not component, not a class, just a regular sequence of PHP functions definitions). What is the correct way to do this under Yii framework? Should I use plain require_once()? require_once(Yii::app()->basePath . '/extensions/my-php-file.php'); Right? 回答1: Yes, that's correct. Example: require_once Yii::app()->basePath . '/extensions/PearMail/Mail-1.2.0/Mail.php'; 回答2: Method in your question is fine, but forces file location to

Changing pattern of url to accept username like facebook

江枫思渺然 提交于 2019-12-23 05:20:03
问题 I need to covert user profile link from this http://example.com/site/index?user_id=sami.yaqoub To be like Facebook http://example.com/sami.yaqoub I changed the rules of config file to except that. Config.php <?php .. 'urlManager' => array( 'urlFormat' => 'path', 'showScriptName' => false, 'rules' => array( '<controller:\w+>/<id:\d+>' => '<controller>/view', '<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>', '<controller:\w+>/<action:\w+>' => '<controller>/<action>', '<user:

Select2 with multiple attribute is not working with modal

☆樱花仙子☆ 提交于 2019-12-23 05:02:41
问题 I am using TbSelect2 to allow users to choose multiple data and it works fine then. But when I tried to use it with modal, it doesn't work. Does anyone have an idea? Thanks in advance. Edit: view.php <?php $this->beginWidget('bootstrap.widgets.TbModal', array('id' => 'advanceModal')); ?> <div class="modal-header"> <a class="close" data-dismiss="modal">×</a> <h4>User</h4> </div> <div class ="modal-body" id="newmodal"> </div> <div class="modal-footer"> <?php $this->widget('bootstrap.widgets

Yii framework “meta db model” creation + postgres inheritance

我的梦境 提交于 2019-12-23 04:52:50
问题 I have few DB tables, witch are build using inheritance from one table witch is an sort of "template" for creation of new tables, and now i have set of businesses logic methods witch work on columns inherit from template, additional columns are used only as params for presentation of models, they're have no meaning for logic. The goal is to share businesses logic methods along all of that tables, i know, now it can be done by adding another class witch extends CActiveRecord, and extend from

Yii Design - How to split the View logic?

青春壹個敷衍的年華 提交于 2019-12-23 04:44:07
问题 MVC is a fairly new concept for me and I have just found myself doing something I am not quite sure would be considered 'a good practice'. I have a controller User (extending from CUserController ) that deals with all user relate actions. In this controller I have actionLogin that deals with login requests. Now in the process of login I need to display 3 different pages according to situation: Login form (enter username/password). Error message (if user details match but account is marked as