/**
  * Scan for new or vanished actions in a controller
  *
  * Controller Id must be given via request paramenter "control"
  *
  * @view views/scripts/action/scan.phtml
  * @access public
  */
 public function scanAction()
 {
     $ctrl = $this->dbController->find($this->checkControllerIdParam());
     $vCtrl = new Admin_Model_DbRow_Controller();
     $all = array();
     $vVanish = array();
     $vNew = array();
     if ($ctrl->count() === 1) {
         $ctrlRow = $vCtrl->fromArray($ctrl->current());
         foreach ($this->dbAction->findActionByControllerId($ctrlRow->get('id')) as $row) {
             $all[] = new Admin_Model_DbRow_Action($row);
         }
         $scanned = $this->ctrlActionModel->getActions($ctrlRow->get('moduleName'), $ctrlRow->get('controllerName'), $ctrlRow->get('virtual'));
         $vNew = $this->dbAction->filterExistingActions($ctrlRow->get('id'), $scanned);
         $vVanish = $this->ctrlActionModel->filterVanishedActions($all, $scanned);
     }
     $this->view->controller = $vCtrl;
     $this->view->vanished = $vVanish;
     $this->view->new = $vNew;
 }
 /**
  * Load the Actions for a specific Controller
  *  0 => Everything is fine, controller found as file and is in the Database (OK)
  *  1 => Controller found in file, but is not in database (NEW)
  *  2 => Controller found in database, but file reference vanished (DEL)
  *
  * @return array
  */
 public function loadControllerActionsAction()
 {
     $controllerDbModel = new Admin_Model_DbTable_Acl_ModuleController();
     $actionDbModel = new Admin_Model_DbTable_Acl_Action();
     $actionScanModel = new Admin_Model_Acl_ControllersActions();
     $controllerRow = new Admin_Model_DbRow_Controller($controllerDbModel->find($this->request->getParam('cid', 0)));
     $return = array();
     if ($controllerRow->get('id')) {
         $dbActions = array();
         foreach ($actionDbModel->findActionByControllerId($controllerRow->get('id')) as $dbAction) {
             $dbActions[] = new Admin_Model_DbRow_Action($dbAction);
         }
         $scannedActions = $actionScanModel->getActions($controllerRow->get('moduleName'), $controllerRow->get('controllerName'), $controllerRow->get('virtual'));
         $newActions = $actionDbModel->filterExistingActions($controllerRow->get('id'), $scannedActions);
         $vanishedActions = $actionScanModel->filterVanishedActions($dbActions, $scannedActions);
         foreach ($dbActions as $action) {
             $return[] = $action->fromArray(array('moduleName' => $controllerRow->get('moduleName'), 'controllerName' => $controllerRow->get('controllerName'), 'status' => '0'))->toJsonArray();
         }
         foreach ($newActions as $action) {
             $return[] = $action->fromArray(array('moduleName' => $controllerRow->get('moduleName'), 'controllerName' => $controllerRow->get('controllerName'), 'enabled' => 0, 'status' => 1))->toJsonArray();
         }
         foreach ($vanishedActions as $action) {
             $return[] = $action->fromArray(array('moduleName' => $controllerRow->get('moduleName'), 'controllerName' => $controllerRow->get('controllerName'), 'status' => 2))->toJsonArray();
         }
     }
     return $this->responseSuccess(array('actions' => $return));
 }