예제 #1
0
 function doSpecificMassiveActions($input = array())
 {
     $res = array('ok' => 0, 'ko' => 0, 'noright' => 0);
     $domain_item = new PluginDomainsDomain_Item();
     switch ($input['action']) {
         case "Transfert":
             if ($input['itemtype'] == 'PluginDomainsDomain') {
                 foreach ($input["item"] as $key => $val) {
                     if ($val == 1) {
                         $this->getFromDB($key);
                         $type = PluginDomainsDomainType::transfer($this->fields["plugin_domains_domaintypes_id"], $input['entities_id']);
                         if ($type > 0) {
                             $values["id"] = $key;
                             $values["plugin_domains_domaintypes_id"] = $type;
                             if ($this->update($values)) {
                                 $res['ok']++;
                             } else {
                                 $res['ko']++;
                             }
                         }
                         unset($values);
                         $values["id"] = $key;
                         $values["entities_id"] = $input['entities_id'];
                         if ($this->update($values)) {
                             $res['ok']++;
                         } else {
                             $res['ko']++;
                         }
                     }
                 }
             }
             break;
         case "Install":
             foreach ($input["item"] as $key => $val) {
                 if ($val == 1) {
                     $values = array('plugin_domains_domains_id' => $key, 'items_id' => $input["item_item"], 'itemtype' => $input['typeitem']);
                     if ($domain_item->add($values)) {
                         $res['ok']++;
                     } else {
                         $res['ko']++;
                     }
                 }
             }
             break;
         case "Desinstall":
             foreach ($input["item"] as $key => $val) {
                 if ($val == 1) {
                     if ($domain_item->deleteItemByDomainsAndItem($key, $input['item_item'], $input['typeitem'])) {
                         $res['ok']++;
                     } else {
                         $res['ko']++;
                     }
                 }
             }
             break;
         default:
             return parent::doSpecificMassiveActions($input);
             break;
     }
     return $res;
 }
예제 #2
0
파일: hook.php 프로젝트: geldarr/hack-space
function plugin_domains_MassiveActionsProcess($data)
{
    $res = array('ok' => 0, 'ko' => 0, 'noright' => 0);
    $domain_item = new PluginDomainsDomain_Item();
    switch ($data['action']) {
        case "plugin_domains_add_item":
            foreach ($data["item"] as $key => $val) {
                if ($val == 1) {
                    $input = array('plugin_domains_domains_id' => $data['plugin_domains_domains_id'], 'items_id' => $key, 'itemtype' => $data['itemtype']);
                    if ($domain_item->can(-1, 'w', $input)) {
                        if ($domain_item->can(-1, 'w', $input)) {
                            $domain_item->add($input);
                            $res['ok']++;
                        } else {
                            $res['ko']++;
                        }
                    } else {
                        $res['noright']++;
                    }
                }
            }
            break;
    }
}
예제 #3
0
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Domains. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
include '../../../inc/includes.php';
if (!isset($_GET["id"])) {
    $_GET["id"] = "";
}
if (!isset($_GET["withtemplate"])) {
    $_GET["withtemplate"] = "";
}
$domain = new PluginDomainsDomain();
$domain_item = new PluginDomainsDomain_Item();
if (isset($_POST["add"])) {
    $domain->check(-1, 'w', $_POST);
    $newID = $domain->add($_POST);
    Html::back();
} else {
    if (isset($_POST["delete"])) {
        $domain->check($_POST['id'], 'w');
        $domain->delete($_POST);
        $domain->redirectToList();
    } else {
        if (isset($_POST["restore"])) {
            $domain->check($_POST['id'], 'w');
            $domain->restore($_POST);
            $domain->redirectToList();
        } else {