/** * processEntry * * Add button onclick handler * * @param array $map * Request data */ function processEntry($map) { $currentuser = isset($map['easycontactusr']) ? $map['easycontactusr'] : NULL; if (is_null($currentuser)) { return; } $ownerid = $currentuser->id; $id = intval($map['oid']); if ($id == 0) { return; } $entry = EasyContactFormsClassLoader::getObject('CustomFormsEntries', TRUE, $id); $entry->process($ownerid); unset($map['oid']); unset($map['n']); $mn = isset($map['a']) ? 'viewDetailed' : 'view'; $map['m'] = $mn; EasyContactFormsRoot::processEvent($map); }
/** * processEntry * * @param $map * * * @return * */ function processEntry($map) { $currentuser = isset($map['easycontactusr']) ? $map['easycontactusr'] : NULL; if (is_null($currentuser)) { return; } $newobjectmap = array(); $newobjectmap['easycontactusr'] = $currentuser; $id = intval($map['oid']); if ($id == 0) { return; } $entry = EasyContactFormsClassLoader::getObject('CustomFormsEntries', TRUE, $id); $content = $entry->get('Content'); $xml = simplexml_load_string($content); $userid = (string) $xml->attributes()->userid; $userid = empty($userid) ? NULL : intval($userid); if (empty($userid)) { $users = EasyContactFormsClassLoader::getObject('Users'); $user = $users->getEmptyObject($newobjectmap); $siteuserid = $entry->get('SiteUser'); $siteuserid = empty($siteuserid) ? NULL : $siteuserid; if (!is_null($siteuserid)) { $usrquery = "SELECT\n\t\t\t\t\t\t\tuser_login AS username,\n\t\t\t\t\t\t\tuser_email AS email,\n\t\t\t\t\t\t\tdisplay_name AS name\n\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t#wp__users\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\tID='{$siteuserid}'"; $susr = EasyContactFormsDB::getObjects($usrquery); $susr = $susr[0]; $susrname = !empty($susr->name) ? $susr->name : $susr->username; if (empty($susrname)) { $user->set('Description', $susrname); } if (empty($susr->email)) { $user->set('email', $susr->email); } $user->set('CMSId', $siteuserid); } } else { $user = EasyContactFormsClassLoader::getObject('Users', true, $userid); $user->user = $currentuser; } $user->save(); $entry->set('Date', EasyContactFormsUtils::getDate($entry->get('Date'), false, true, true)); $entry->set('Users', $user->get('id')); $entry->save(); $form = EasyContactFormsClassLoader::getObject('CustomForms', true, $entry->get('CustomForms')); $form->set('TotalProcessedEntries', $form->get('TotalProcessedEntries') + 1); $form->save(); unset($map['oid']); unset($map['n']); $mn = isset($map['a']) ? 'viewDetailed' : 'view'; $map['m'] = $mn; EasyContactFormsRoot::processEvent($map); }
/** * resetStatistics * * @param $map * * * @return * */ function resetStatistics($map) { $fid = intval($map['oid']); if (empty($fid)) { return; } $form = EasyContactFormsClassLoader::getObject('CustomForms', true, $fid); $form->set('Impressions', 0); $form->set('TotalEntries', 0); $form->set('TotalProcessedEntries', 0); $form->save(); $map['m'] = 'show'; EasyContactFormsRoot::processEvent($map); }
/** * processRequest * * this is a sibling of the processEvent method. Currently does nothing * * @param array $_reqmap * incoming request */ function processRequest($_reqmap) { EasyContactFormsRoot::processEvent($_reqmap); }
/** * setFormPageStatisticsShowOnDashboard * * @param $map * * * @return * */ function setFormPageStatisticsShowOnDashboard($map) { $objid = intval($map['oid']); $obj = EasyContactFormsClassLoader::getObject('CustomFormEntryStatistics', true, $objid); $bval = $map['a'] == 'true' ? true : false; $obj->set('IncludeIntoReporting', $bval); $obj->save(); $map['m'] = 'viewDetailed'; EasyContactFormsRoot::processEvent($map); }
/** * moveFieldSet * * Moves a fieldset up and down * * @param $map * */ function moveFieldSet($map) { $filter = array(); $filter['fnames'] = array(); $filter['fnames'][] = 'CustomFormFields.Type IN (:type)'; $filter['fvalues'] = array(); $filter['fvalues'][':type'] = array(); $filter['fvalues'][':type'][] = 1; $filter['fvalues'][':type'][] = 2; $rparams = $this->getFilter($map); $filter['fnames'][] = 'CustomFormFields.CustomForms = :CustomForms'; $cf = intval($rparams['CustomForms']->values[0]); $filter['fvalues'][':CustomForms'] = $cf; EasyContactFormsRoot::moveRow('CustomFormFields', $map, $filter, 'CustomFormFields'); $forms = EasyContactFormsClassLoader::getObject('CustomForms'); $forms->updateTemplate($cf); $map['m'] = 'viewDetailed'; EasyContactFormsRoot::processEvent($map); }