本文整理汇总了PHP中CommonDBRelation::doSpecificMassiveActions方法的典型用法代码示例。如果您正苦于以下问题:PHP CommonDBRelation::doSpecificMassiveActions方法的具体用法?PHP CommonDBRelation::doSpecificMassiveActions怎么用?PHP CommonDBRelation::doSpecificMassiveActions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CommonDBRelation
的用法示例。
在下文中一共展示了CommonDBRelation::doSpecificMassiveActions方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doSpecificMassiveActions
/**
* @see CommonDBTM::doSpecificMassiveActions()
**/
function doSpecificMassiveActions($input = array())
{
$res = array('ok' => 0, 'ko' => 0, 'noright' => 0);
switch ($input['action']) {
default:
return parent::doSpecificMassiveActions($input);
}
return $res;
}
示例2: doSpecificMassiveActions
/**
* @see CommonDBTM::doSpecificMassiveActions()
*
* @since version 0.84
**/
function doSpecificMassiveActions($input = array())
{
$res = array('ok' => 0, 'ko' => 0, 'noright' => 0);
switch ($input['action']) {
case "solveticket":
$ticket = new Ticket();
foreach ($input["item"] as $key => $val) {
if ($val == 1) {
if ($this->can($key, 'r')) {
if ($ticket->getFromDB($this->fields['tickets_id']) && $ticket->canSolve()) {
$toupdate = array();
$toupdate['id'] = $ticket->getID();
$toupdate['solutiontypes_id'] = $input['solutiontypes_id'];
$toupdate['solution'] = $input['solution'];
if ($ticket->update($toupdate)) {
$res['ok']++;
} else {
$res['ko']++;
}
} else {
$res['noright']++;
}
} else {
$res['noright']++;
}
}
}
break;
default:
return parent::doSpecificMassiveActions($input);
}
return $res;
}
示例3: doSpecificMassiveActions
/**
* Do the specific massive actions
*
* @since version 0.84
*
* @param $input array of input datas
*
* @return an array of results (nbok, nbko, nbnoright counts)
**/
function doSpecificMassiveActions($input = array())
{
$res = array('ok' => 0, 'ko' => 0, 'noright' => 0);
$typo_item = new PluginTypologyTypology_Item();
switch ($input['action']) {
case "delete_item":
if ($input['itemtype'] == 'PluginTypologyTypology_Item') {
foreach ($input["item"] as $key => $val) {
if ($val != 0) {
$typo_item->getFromDB($key);
if ($typo_item->delete(array('id' => $key))) {
$values = array('plugin_typology_typologies_id' => $input['plugin_typology_typologies_id'], 'items_id' => $typo_item->fields['items_id'], 'itemtype' => $typo_item->fields['itemtype']);
PluginTypologyTypology_Item::addLog($values, PluginTypologyTypology_Item::LOG_DELETE);
$res['ok']++;
} else {
$res['ko']++;
}
}
}
}
break;
case "update_allitem":
if ($input['itemtype'] == 'PluginTypologyTypology_Item') {
foreach ($input["item"] as $key => $val) {
if ($val != 0) {
$typo_item->getFromDB($key);
$result = PluginTypologyTypology_Item::checkValidated(array('items_id' => $typo_item->fields['items_id'], 'plugin_typology_typologies_id' => $typo_item->fields['plugin_typology_typologies_id'], 'id' => $typo_item->fields['id']));
if ($typo_item->update($result)) {
$values = array('plugin_typology_typologies_id' => $typo_item->fields['plugin_typology_typologies_id'], 'items_id' => $typo_item->fields['items_id'], 'itemtype' => $typo_item->fields['itemtype']);
PluginTypologyTypology_Item::addLog($values, PluginTypologyTypology_Item::LOG_UPDATE);
$res['ok']++;
} else {
$res['ko']++;
}
}
}
}
break;
default:
return parent::doSpecificMassiveActions($input);
}
return $res;
}
示例4: doSpecificMassiveActions
/**
* @see CommonDBTM::doSpecificMassiveActions()
**/
function doSpecificMassiveActions($input = array())
{
$res = array('ok' => 0, 'ko' => 0, 'noright' => 0);
switch ($input['action']) {
case "add_user_group":
case "add_supervisor_group":
case "add_delegatee_group":
foreach ($input["item"] as $key => $val) {
if ($val == 1) {
if (isset($input['users_id'])) {
// Add users to groups
$input2 = array('groups_id' => $key, 'users_id' => $input['users_id']);
} else {
if (isset($input['groups_id'])) {
// Add groups to users
$input2 = array('groups_id' => $input["groups_id"], 'users_id' => $key);
} else {
return false;
}
}
$updateifnotfound = false;
if ($input["action"] == 'add_supervisor_group') {
$input2['is_manager'] = 1;
$updateifnotfound = true;
}
if ($input["action"] == 'add_delegatee_group') {
$input2['is_userdelegate'] = 1;
$updateifnotfound = true;
}
$group = new Group();
$user = new user();
if ($group->getFromDB($input2['groups_id']) && $user->getFromDB($input2['users_id'])) {
if ($updateifnotfound && $this->getFromDBForItems($user, $group)) {
if ($this->can($this->getID(), 'w')) {
$input2['id'] = $this->getID();
if ($this->update($input2)) {
$res['ok']++;
} else {
$res['ko']++;
}
} else {
$res['noright']++;
}
} else {
if ($this->can(-1, 'w', $input2)) {
if ($this->add($input2)) {
$res['ok']++;
} else {
$res['ko']++;
}
} else {
$res['noright']++;
}
}
} else {
$res['ko']++;
}
}
}
break;
default:
return parent::doSpecificMassiveActions($input);
}
return $res;
}
示例5: doSpecificMassiveActions
/**
* @since version 0.84
*
* @see CommonDBTM::doSpecificMassiveActions()
**/
function doSpecificMassiveActions($input = array())
{
$res = array('ok' => 0, 'ko' => 0, 'noright' => 0);
switch ($input['action']) {
case "move_license":
if (isset($input['softwarelicenses_id'])) {
foreach ($input["item"] as $key => $val) {
if ($val == 1) {
//Get software name and manufacturer
if ($this->can($key, 'w')) {
//Process rules
if ($this->update(array('id' => $key, 'softwarelicenses_id' => $input['softwarelicenses_id']))) {
$res['ok']++;
} else {
$res['ko']++;
}
} else {
$res['noright']++;
}
}
}
} else {
$res['ko']++;
}
break;
case "install":
$csl = new self();
$csv = new Computer_SoftwareVersion();
foreach ($input["item"] as $key => $val) {
if ($val == 1) {
if ($csl->getFromDB($key)) {
$sl = new SoftwareLicense();
if ($sl->getFromDB($csl->fields["softwarelicenses_id"])) {
$version = 0;
if ($sl->fields["softwareversions_id_use"] > 0) {
$version = $sl->fields["softwareversions_id_use"];
} else {
$version = $sl->fields["softwareversions_id_buy"];
}
if ($version > 0) {
$params = array('computers_id' => $csl->fields['computers_id'], 'softwareversions_id' => $version);
//Get software name and manufacturer
if ($csv->can(-1, 'w', $params)) {
//Process rules
if ($csv->add($params)) {
$res['ok']++;
} else {
$res['ko']++;
}
} else {
$res['noright']++;
}
} else {
$res['ko']++;
}
} else {
$res['ko']++;
}
} else {
$res['ko']++;
}
}
}
break;
default:
return parent::doSpecificMassiveActions($input);
}
return $res;
}
示例6: doSpecificMassiveActions
/**
* @see CommonDBTM::doSpecificMassiveActions()
**/
function doSpecificMassiveActions($input = array())
{
$res = array('ok' => 0, 'ko' => 0, 'noright' => 0);
switch ($input['action']) {
case "add_contact_supplier":
$contactsupplier = new Contact_Supplier();
foreach ($input["item"] as $key => $val) {
if (isset($input['contacts_id'])) {
$input = array('suppliers_id' => $key, 'contacts_id' => $input['contacts_id']);
} else {
if (isset($input['suppliers_id'])) {
$input = array('suppliers_id' => $input['suppliers_id'], 'contacts_id' => $key);
} else {
return false;
}
}
if ($contactsupplier->can(-1, 'w', $input)) {
if ($contactsupplier->add($input)) {
$res['ok']++;
} else {
$res['ko']++;
}
} else {
$res['noright']++;
}
}
break;
default:
return parent::doSpecificMassiveActions($input);
}
return $res;
}
示例7: doSpecificMassiveActions
/**
* @see CommonDBTM::doSpecificMassiveActions()
**/
function doSpecificMassiveActions($input = array())
{
$res = array('ok' => 0, 'ko' => 0, 'noright' => 0);
switch ($input['action']) {
case "connect":
foreach ($input["item"] as $key => $val) {
if ($val == 1) {
if (isset($input["computers_id"])) {
$input2 = array('computers_id' => $input["computers_id"], 'itemtype' => $input["itemtype"], 'items_id' => $key);
} else {
if (isset($input["items_id"])) {
$input2 = array('computers_id' => $key, 'itemtype' => $input["item_itemtype"], 'items_id' => $input["items_id"]);
} else {
return false;
}
}
if ($this->can(-1, 'w', $input2)) {
if ($this->add($input2)) {
$res['ok']++;
} else {
$res['ko']++;
}
} else {
$res['noright']++;
}
}
}
break;
case "disconnect":
if (!($item = getItemForItemtype($input["itemtype"]))) {
return false;
}
foreach ($input["item"] as $key => $val) {
if ($val == 1) {
if ($item->can($key, 'd')) {
if ($this->disconnectForItem($item)) {
$res['ok']++;
} else {
$res['ko']++;
}
} else {
$res['noright']++;
}
}
}
break;
default:
return parent::doSpecificMassiveActions($input);
}
return $res;
}
示例8: doSpecificMassiveActions
/**
* @see CommonDBTM::doSpecificMassiveActions()
* @param array $input
* @return array
*/
function doSpecificMassiveActions($input = array())
{
$res = array('ok' => 0, 'ko' => 0, 'noright' => 0);
switch ($input['action']) {
case 'deleteSelected':
if (isset($_POST['itemtype']) && $_POST['itemtype'] == 'PluginFpsoftwareCommon' && isset($_POST['item']) && is_array($_POST['item'])) {
foreach ($_POST['item'] as $id => $val) {
self::deleteItem($id);
$res['ok']++;
}
} else {
$res['ko']++;
}
break;
default:
return parent::doSpecificMassiveActions($input);
}
return $res;
}
示例9: doSpecificMassiveActions
/**
* @since version 0.84
*
* @see CommonDBTM::doSpecificMassiveActions()
**/
function doSpecificMassiveActions($input = array())
{
$res = array('ok' => 0, 'ko' => 0, 'noright' => 0);
switch ($input['action']) {
case "move_version":
if (isset($input['softwareversions_id'])) {
foreach ($input["item"] as $key => $val) {
if ($val == 1) {
//Get software name and manufacturer
if ($this->can($key, 'w')) {
//Process rules
if ($this->update(array('id' => $key, 'softwareversions_id' => $input['softwareversions_id']))) {
$res['ok']++;
} else {
$res['ko']++;
}
} else {
$res['noright']++;
}
}
}
} else {
$res['ko']++;
}
break;
default:
return parent::doSpecificMassiveActions($input);
}
return $res;
}