Jump to content
Larry Ullman's Book Forums

nkhanna24

Members
  • Posts

    14
  • Joined

  • Last visited

Posts 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. Could you be more specific? How do you know $this->isNewRecord is returning true. And when you say "it calls the function", what is "it" and what function? Have you tried doing a stack trace to see what functions are and are not being called, and in what order?

    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. Logically, then, it would see that the $this->isNewRecord conditional is returning false in addActivityextend(), although that shouldn't be the case considering the code in your controller. But that's what I would first confirm.

    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. 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???

  6. 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...?

  7. 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?

  8. 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

     

  9. 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...