Willkommen, Gast
Benutzername: Passwort: Angemeldet bleiben:

THEMA: Create a new view in plugin

Create a new view in plugin 10 Monate 4 Wochen her #106827

  • elvey
  • elveys Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 2
  • Karma: 0
I'm developing a plugin that requires me to create an additional view. Unfortunately documentation on the plugin environment is a little slim and I can't find for the life of me how to create a new view/controller in my plugin.
Would someone be able to point me towards the appropriate resources for this task? Thanks you
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Create a new view in plugin 10 Monate 4 Wochen her #106876

  • DenisChenu
  • DenisChenus Avatar
  • OFFLINE
  • Moderator Lime
  • Beiträge: 6884
  • Dank erhalten: 924
  • Karma: 275
Hi,

There are no existing included solution actually, have some hack to do it actually

Starting by
$aData['clang'] = $clang = Yii::app()->lang;
            $aData['sImageURL'] = Yii::app()->getConfig('adminimageurl');
            $aData['surveyid']=$aData['iSurveyID']=$aData['iSurveyId'] = $this->iSurveyId;
            $sViewPath = '/admin/survey';
            $oAdminController=new AdminController('admin');
            $oCommonAction = new Survey_Common_Action($oAdminController,'survey');
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Create a new view in plugin 10 Monate 3 Wochen her #106914

  • elvey
  • elveys Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 2
  • Karma: 0
Thanks for your help. I will however ask for a little more guidance if possible.

I am guessing this is creating a new action which is then saved to the admin controller. However I am unsure where the action code is set. Is there a parameter I can use to set a callback method? Otherwise I see most existing actions have classes that extend Survey_Common_Action in application/controllers/admin so could I create another class such as this that can be loaded from within my plugin directory?

Finally I'm not sure what to do with $sViewPath. Should this be set in $aData?
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Create a new view in plugin 8 Monate 1 Woche her #109957

  • atlet
  • atlets Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 17
  • Karma: 0
Any luck with creation of new view? I'll looking to create a plugin and will need to create a nev view in admin area...
elvey schrieb:
Thanks for your help. I will however ask for a little more guidance if possible.

I am guessing this is creating a new action which is then saved to the admin controller. However I am unsure where the action code is set. Is there a parameter I can use to set a callback method? Otherwise I see most existing actions have classes that extend Survey_Common_Action in application/controllers/admin so could I create another class such as this that can be loaded from within my plugin directory?

Finally I'm not sure what to do with $sViewPath. Should this be set in $aData?
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Create a new view in plugin 8 Monate 1 Woche her #109961

  • DenisChenu
  • DenisChenus Avatar
  • OFFLINE
  • Moderator Lime
  • Beiträge: 6884
  • Dank erhalten: 924
  • Karma: 275
In one of my old plugin (surely need better suystem and adpatation, i use this (adding a new page for survey)
private function displayContent($aData=false)
        {
            if(!$aData){$aData=array();}
            $aData['clang'] = $clang = Yii::app()->lang;
            $aData['sImageURL'] = Yii::app()->getConfig('adminimageurl');
            $aData['surveyid']=$aData['iSurveyID']=$aData['iSurveyId'] = $this->iSurveyId;
            $sViewPath = '/admin/survey';
            $oAdminController=new AdminController('admin');
            $oCommonAction = new Survey_Common_Action($oAdminController,'survey');
            ob_start();
            //header("Content-type: text/html; charset=UTF-8"); // needed for correct UTF-8 encoding
            $oAdminController->_getAdminHeader();
            $oAdminController->_showadminmenu($this->iSurveyId);
            if($this->iSurveyId)
                $oCommonAction->_surveybar($this->iSurveyId);
            if($this->fContent){
                self::render($this->fContent,$aData);// Surely better with ->render ....
            }
            $oAdminController->_loadEndScripts();
            $oAdminController->_getAdminFooter('http://manual.limesurvey.org', $clang->gT('LimeSurvey online manual'));
            $sOutput = ob_get_contents();
            ob_clean();
            App()->getClientScript()->render($sOutput);
            echo $sOutput;
            Yii::app()->end();
        }
        private function render($file,$aData=false){
            if($aData)
            {
                foreach($aData as $data=>$value){
                    $$data=$value;
                }
            }
            include_once(dirname(__FILE__)."/".$this->fContent);// Surely better with ->render ....
        }
Letzte Änderung: 8 Monate 1 Woche her von DenisChenu.
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Create a new view in plugin 6 Monate 5 Tage her #111804

  • sparkbird
  • sparkbirds Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 1
  • Dank erhalten: 2
  • Karma: 0
Der Administrator hat öffentliche Schreibrechte deaktiviert.
Folgende Benutzer bedankten sich: david2013, jdd2405

Create a new view in plugin 2 Monate 3 Wochen her #115159

  • david2013
  • david2013s Avatar
  • OFFLINE
  • Junior Lime
  • Beiträge: 39
  • Dank erhalten: 4
  • Karma: 2
Thank you for sharing. We need more document ion regarding plugin.

When I download it using latest version. I doesn't work. After I change the line below, it works for me
'href' => "plugins/direct/rewards?function=assignRewards",
to
'href' => $this->api->createUrl('plugins/direct', array('plugin' => 'Rewards', 'function' => 'assignRewards')),
Letzte Änderung: 2 Monate 3 Wochen her von david2013.
Der Administrator hat öffentliche Schreibrechte deaktiviert.
Folgende Benutzer bedankten sich: jdd2405

Create a new view in plugin 1 Woche 1 Tag her #117420

  • jdd2405
  • jdd2405s Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 1
  • Karma: 0
The Plugin from sparkbird is great to begin with a new admin menu item. Thanks david2013 for the fix. I wouldn't have been able to do that...

Anyway, the admin menu item only shows up when visiting the plugins page. On the admin start page and all the other admin pages there is no additional menu item visible. Why is that?
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Create a new view in plugin 1 Woche 17 Stunden her #117425

  • DenisChenu
  • DenisChenus Avatar
  • OFFLINE
  • Moderator Lime
  • Beiträge: 6884
  • Dank erhalten: 924
  • Karma: 275
jdd2405 schrieb:
Anyway, the admin menu item only shows up when visiting the plugins page. On the admin start page and all the other admin pages there is no additional menu item visible. Why is that?
Because only plugin page use the new menu extension.
Der Administrator hat öffentliche Schreibrechte deaktiviert.
Folgende Benutzer bedankten sich: jdd2405
Ladezeit der Seite: 0.367 Sekunden
Donation Image