Example #1
0
 public function getManageActions(Aitoc_Aitsys_Model_Module_License $license, $info = array())
 {
     $adminhtml = $this->getAdminhtmlHelper();
     $actions = array();
     switch (true) {
         case $license->isUninstalled() && (isset($info['confirmed']) && $info['confirmed']):
             $url = $adminhtml->getUrl('aitsys/license/install', array('modulekey' => $license->getModule()->getKey()));
             $actions['back'] = array('label' => $this->__('Cancel'), 'onclick' => 'setLocation(\'' . $adminhtml->getUrl('aitsys') . '\')', 'class' => 'back');
             $actions['install'] = array('label' => $this->__('Proceed to install'), 'id' => 'proceed_to_install', 'onclick' => 'editForm.submit(\'' . $url . '\');');
             if ($license instanceof Aitoc_Aitsys_Model_Module_License_Light && !$license->getPerformer()) {
                 $actions['install']['disabled'] = true;
             }
             break;
         case $license->isInstalled():
             $actions['back'] = array('label' => $this->__('Back'), 'onclick' => 'setLocation(\'' . $adminhtml->getUrl('aitsys') . '\')', 'class' => 'back');
             if ($license->getUpgrade()->hasUpgrade()) {
                 $upgradeUrl = $adminhtml->getUrl('aitsys/license/upgrade', array('modulekey' => $license->getModule()->getKey()));
                 $actions['upgrade'] = array('label' => $this->__('Upgrade license'), 'onclick' => "deleteConfirm('" . $this->__('Are you sure you want to upgrade module license?') . "','" . $upgradeUrl . "')", 'disabled' => !$license->getUpgrade()->canUpgrade(), 'class' => 'save ' . ($license->getUpgrade()->canUpgrade() ? '' : 'disabled'));
             }
             $deleteUrl = $adminhtml->getUrl('aitsys/license/delete', array('modulekey' => $license->getModule()->getKey()));
             $actions['uninstall'] = array('label' => $this->__('Uninstall module and license'), 'onclick' => "deleteConfirm('" . $this->__('Are you sure?') . "','" . $deleteUrl . "')", 'class' => 'delete');
             break;
         case $license->isUninstalled():
             $url = $adminhtml->getUrl('aitsys/license/confirm', array('modulekey' => $license->getModule()->getKey()));
             $actions['back'] = array('label' => $this->__('Do not Agree and Cancel'), 'onclick' => 'setLocation(\'' . $adminhtml->getUrl('aitsys') . '\')', 'class' => 'back');
             $actions['install'] = array('label' => $this->__('Confirm agreement and install'), 'id' => 'confirm_and_install', 'onclick' => 'editForm.submit(\'' . $url . '\');');
             break;
     }
     return $actions;
 }