function _moduleContent(&$smarty, $module_name) { //global variables global $arrConf; //folder path for custom templates $local_templates_dir = getWebDirModule($module_name); //conexion resource $pDB = new paloDB($arrConf['elastix_dsn']['elastix']); //return array("idUser"=>$idUser,"id_organization"=>$idOrganization,"userlevel"=>$userLevel1,"domain"=>$domain); global $arrCredentials; //actions $accion = getAction(); switch ($accion) { case 'saveNew': $content = saveContact($smarty, $module_name, $local_templates_dir, $pDB, $arrConf); break; case "saveEdit": $content = editContact($smarty, $module_name, $local_templates_dir, $pDB, $arrConf); break; case 'uploadImageContact': $content = uploadImageContact($smarty, $module_name, $local_templates_dir, $pDB, $arrConf); break; case 'deleteContacts': $content = deleteContacts($smarty, $module_name, $local_templates_dir, $pDB, $arrConf); break; case 'uploadCSV': $content = uploadCSV($smarty, $module_name, $local_templates_dir, $pDB, $arrConf); break; case 'templateContact': $content = templateContact($smarty, $module_name, $local_templates_dir, $pDB, $arrConf); break; case "getImageExtContact": $content = getImageExtContact($smarty, $module_name, $local_templates_dir, $pDB, $arrConf); break; case "getImageTmp": $content = getImageTmp($smarty, $module_name, $local_templates_dir, $pDB, $arrConf); break; case "call2phone": $content = call2phone($smarty, $module_name, $local_templates_dir, $pDB, $arrConf); break; case "transfer_call": $content = transferCALL($smarty, $module_name, $local_templates_dir, $pDB, $arrConf); break; default: $content = reportContact($smarty, $module_name, $local_templates_dir, $pDB, $arrConf); break; } return $content; }
{ $assignParams = array("method" => "POST", "ContactsListID" => $listID, "DataID" => $uploadID, "Method" => "addnoforce"); $csvAssign = $mj->csvimport($assignParams); if ($mj->_response_code == 201) { echo "success - CSV data " . $uploadID . " assigned to contactslist " . $listID; return $csvAssign->Data[0]->ID; } else { exit("error - Couldn't assign contacts to list - code " . $mj->_response_code); } } function monitor($mj, $jobID) { $monitorParmas = array("method" => "VIEW", "ID" => $jobID); $res = $mj->batchjob($monitorParmas); if ($mj->_response_code == 200) { echo "job " . $res->Data[0]->Status . "\n"; return $res->Data[0]->Status; } else { exit("error - Couldn't monitor the job - code " . $mj->_response_code . "\n"); } } $mj = new Mailjet('MJ_APIKEY_PUBLIC', 'MJ_APIKEY_PRIVATE'); /* * Don't forget to change the $listID variable to suit your particular setup. * */ $listID = 45; $CSVContent = file_get_contents('sample.csv'); $uploadID = uploadCSV($mj, $listID, $CSVContent); $jobID = assignContactsToList($mj, $listID, $uploadID); $status = monitor($mj, $jobID);