Jump to content
Larry Ullman's Book Forums

nkhanna24

Members
  • Posts

    14
  • Joined

  • Last visited

Everything posted by nkhanna24

  1. Hey guys I am using imperavi-redactor-widget and i am having problem with toolbar Yii::import('ext.imperavi-redactor-widget.ImperaviRedactorWidget'); $this->widget('ImperaviRedactorWidget', array( // you can either use it for model attribute 'model' => $model, 'attribute' => 'description', // or just for input field 'name' => 'description', // some options, see http://imperavi.com/redactor/docs/ 'options' => array( 'lang' => 'en', //'toolbar' =>'' , 'iframe' => true, 'buttons'=>array( 'formatting', '|', 'bold', 'italic', 'deleted', '|', 'unorderedlist', 'orderedlist', 'outdent', 'indent', '|', 'image', 'video', 'link', '|', 'html', ), 'css' => 'wym.css', ), 'plugins' => array( 'fullscreen' => array( 'js' => array('fullscreen.js',), ), 'clips' => array( // You can set base path to assets 'basePath' => 'application.components.imperavi.my_plugin', // or url, basePath will be ignored //'baseUrl' => '/js/my_plugin', 'css' => array('clips.css',''), 'js' => array('clips.js',), // add depends packages 'depends' => array('imperavi-redactor',), ), ), )); It is showing only 1 button, in this case 'formatting' button. and onchange function doesnot seems to be wroking on this ? any ideas? Thanks
  2. i have checked and i am sure(100%) when i call addActivityextend() from controller $this->isNewRecord returns true and $this->addActivity() line works In adActivity() $subscribers = $this->getSubscribers(); this line works(it returns an array) After that i dont know why table does not update??
  3. no,this is not the case $this->isNewRecord is returning true and it calls the function....
  4. hi all i Have a model question.php it has a method public function addActivity() { $subscribers = $this->getSubscribers(); foreach($subscribers as $id) { $n = new Activity(); $n->parentType = Activity::model()->parents['Question']; $n->parentId = $this->id; $n->userId = $id; $n->sourceId = Yii::app()->user->id; $n->activityType = Activity::model()->activities['post']; $n->save(); $user = User::model()->findByPk($id); if($id!=Yii::app()->user->id) $user->notificationsCount=$user->notificationsCount+1; $user->save(); } } this is aftersave() protected function afterSave() { parent::afterSave(); Tag::model()->updateFrequency($this->_oldTags, $this->tags, 'question'); if($this->isNewRecord) { $this->addActivity(); } } This works fine. But what i want to do now is to call addActivity() from another function from same model public function addActivityextend() { if($this->isNewRecord) { $this->addActivity(); } } Instead of aftersave(), i call this funtion from my controller like this $model=new question $model->addActivityextend(); But it doesnot work.Activity table is not populated in this case. but if i call directly $model->addActivity(); It works fine then. What am i missing?? Thankyou in advance
  5. earlier facebook login connect was working fine on my php website but when facebook updated its sdk,its not working.. it simply opens facebook. so what changes has to be done to make it work?
  6. yes actually that is the case.......
  7. there is no error as such.....when i click on button,it takes to the facebook page and this is url https://www.facebook.com/dialog/oauth?client_id=112891755455541&redirect_uri=http%3A%2F%2Flocalhost%2Fsite%2Ffblogin&state=0bfbe3f220a29d0a67e20e3d346c3efd&req_perms=email%2Cpublish_stream%2Cmanage_pages&return_url=http%3A%2F%2Flocalhost%2Fsite%2Ffblogin it displays error line ,so dont know what to do??
  8. public function actionFblogin() { $facebook = new Facebook(Yii::app()->params['fb']['config']); //$session = $facebook->getSession(); $user = $facebook->getUser(); $me = null; // Session based API call. if ($user) { $fb_uid = $facebook->getUser(); if (Yii::app()->user->id) { $user = User::model()->find('fb_uid=?', array($fb_uid)); if ($user === NULL) { Yii::app()->user->setState('fb_uid', $fb_uid); $this->redirect($this->createAbsoluteUrl('profile/settings', array('fbconnect' => 1))); Yii::app()->end(); } else { $this->redirect($this->createAbsoluteUrl('profile/settings', array('fbconnect' => 2))); Yii::app()->end(); } } else { $user = User::model()->find('fb_uid=?', array($fb_uid)); if($user->lastLogin==0) $firstTime=1; $_identity = new FbUserIdentity($fb_uid); $_identity->authenticate(); if ($_identity->errorCode === FbUserIdentity::ERROR_NONE) { $duration = 3600 * 24 * 30; // $this->rememberMe ? 3600*24*30 : 0; // 30 days Yii::app()->user->login($_identity, $duration); if($firstTime==1) $this->redirect($this->createAbsoluteUrl('site/demo', array('name' => $user->firstName))); else $this->redirect(Yii::app()->user->returnUrl); return true; } else $this->redirect($this->createAbsoluteUrl('site/fbregister')); } } else { $this->redirect($facebook->getLoginUrl(array('req_perms' => Yii::app()->params['fb']['config']['perms'], 'return_url' => $this->createAbsoluteUrl('site/fblogin')))); } } hi i have this actionFblogin in my sitecontroller.php the problem is when i click the button an error occur and it doesnt redirect to my website ? can anybody help me???
  9. okay....it is a question post if i click button1 actionask() is called and question is posted..... there are diff institutes so if i click on button2 it should post in all institutes.....for which i have made a different action actionaskall() in same . so how do i call 2nd action when 2 button is clicked...?
  10. hi all i have a form and two submit buttons.(submit and submit to all) so i have to call two different actions depending on which button is clicked.two actions are in same controller. how can i achieve that? thanks in advance
  11. thankss....got it what i was looking for
  12. hi all I am having this difficulty with this button <div class="row buttons"> <?= CHtml::submitButton('Submit to all', array('class' => 'button-send-v2', 'value' => '','name'=>'all')); ?> <span class="go-back"> <span class="gray-text"> or </span> <?= CHtml::link('Cancel', $this->createAbsoluteUrl('forum/index'), array('class' => 'go-back')); ?> </span> </div> how do i hide this button depending on the user id(Yii::app()->user->id) or at admin login?
  13. hi all how can you add 2 condition in defaultscope() method in model i have this 'condition' => "question.instituteId = " . Yii::app()->params['institute']['id'], i have to add question.instituteId =1, as well. thanks
  14. Hi I am new in yii framework. I came across this code. $criteria=new CDbCriteria(); if(isset($_GET['tag'])) $criteria->addSearchCondition('question.tags',$_GET['tag']); $param = Yii::app()->request->getParam('param'); $dataProvider=new CActiveDataProvider(Question::model()->recent()->with('user')->with('answers')); $this->render('index',array('dataProvider'=>$dataProvider, 'param'=>$param, 'tags'=>$tags, 'usertype'=>$usertype)); can anyone explain what getparam('param') and $this->render() do? and where this 'param' variable coming from ? thanks in advance...
×
×
  • Create New...