Esempio n. 1
0
 function _updateProjectForPlugin($action, $plugin, $projectIds)
 {
     $success = true;
     $successOnce = false;
     if (is_array($projectIds)) {
         foreach ($projectIds as $prjId) {
             switch ($action) {
                 case 'add':
                     $success = $success && $this->plugin_factory->addProjectForPlugin($plugin, $prjId);
                     break;
                 case 'del':
                     $success = $success && $this->plugin_factory->delProjectForPlugin($plugin, $prjId);
                     break;
             }
             if ($success === true) {
                 $successOnce = true;
             }
         }
     } elseif (is_numeric($projectIds)) {
         switch ($action) {
             case 'add':
                 $success = $success && $this->plugin_factory->addProjectForPlugin($plugin, $prjId);
                 break;
             case 'del':
                 $success = $success && $this->plugin_factory->delProjectForPlugin($plugin, $prjId);
                 break;
         }
         $successOnce = $success;
     }
     if ($successOnce && $action == 'add') {
         $this->plugin_factory->restrictProjectPluginUse($plugin, true);
     }
 }