示例#1
0
 public function setPregunta($eid)
 {
     $db = new DB();
     $data['pregunta'] = $_POST['pregunta'];
     $data['encuesta_id'] = $eid;
     $db->perform('preguntas', $data);
     return $db->lastInsertedId();
 }
示例#2
0
 public function setAddEncuesta()
 {
     global $uid;
     $data['titulo'] = $_POST['titulo'];
     $data['observaciones'] = $_POST['observaciones'];
     $data['fecha'] = Utils::now();
     $data['publicado'] = $_POST['publicado'];
     $data['usuarios_id'] = $uid;
     $db = new DB();
     $db->perform('encuestas', $data);
     $eid = $db->lastInsertedId();
     Elfic::cosRedirect('index2.php?com=encuestas&do=edit&eid=' . $eid);
 }
示例#3
0
						postdate = CURRENT_TIMESTAMP,
						fromrepid = ".$DB->safe($_SESSION['loggedin']).",
						torepid = ".$DB->safe($torepid).",
						leadid = ".$DB->safe($_REQUEST['leadid']).",
						cccorrid = ".$cccorrid;

	if($DB->query($sql)){
		print "1:saved";
	}else{
		print("0:Oops, there was an error saving this ".mysql_error());
	}

}

saveCorr($_REQUEST['torepid']);
$parentid = $DB->lastInsertedId();
sendEmails($_REQUEST['torepid'], $parentid);

// get the rep ids
$repids = array();
$reps = explode(", ", $_REQUEST['repnames']);
foreach($reps as $v){
	$name_e = explode(" ", $v);
	$repid = $DB->queryUniqueValue("SELECT id FROM reps 
					   				WHERE firstname = '".$name_e[0]."' 
					   				AND lastname = '".$name_e[1]."'");
	if(strlen(trim($repid))) $repids[] = $repid;
}

print_r($repids);
示例#4
0
 /**
  * @desc Registra datos básicos de un Usuario. Insert o Update
  * @param string $action "new" para nuevo
  * @return void
  */
 public function save($action = null)
 {
     global $uid;
     $db = new DB();
     $data = array();
     $data['nombres'] = $db->sqlInput($_REQUEST['nombres'], 'string');
     $data['apellidos'] = $db->sqlInput($_REQUEST['apellidos'], 'string');
     $data['login'] = $db->sqlInput($_REQUEST['login'], 'string');
     $data['email'] = $db->sqlInput($_REQUEST['email'], 'string');
     $data['modificado'] = Elfic::now();
     $data['activo'] = $db->sqlInput($_REQUEST['activo'], 'string');
     $data['esadmin'] = $db->sqlInput($_REQUEST['esadmin'], 'string');
     if ($action == "new") {
         $data['creado'] = Elfic::now();
         $data['password'] = AuthUser::encrypt_password($_REQUEST['password']);
         $db->perform('usuarios', $data);
         $id = $db->lastInsertedId();
         $msg = MSG_USR_CREATE;
     } else {
         if (isset($_REQUEST['password']) && $_REQUEST['password'] != "") {
             $data['password'] = $db->sqlInput($_REQUEST['password'], 'string');
         }
         $id = $db->sqlInput($_REQUEST['uid'], 'int');
         $db->perform('usuarios', $data, 'update', 'id=' . $id);
         $msg = MSG_USR_UPDATE;
     }
     $url = "index2.php?com=usuarios&do=view&uid=" . $id;
     Elfic::cosRedirect($url, $msg);
 }
示例#5
0
 /**
  * 
  * Registra en DB nuevo comunicado
  * @params globals
  */
 public function setCom()
 {
     global $uid;
     $com = array();
     $com['fecha'] = Erudio::now();
     $com['asunto'] = $_POST['asunto'];
     $com['mensaje'] = $_POST['mensaje'];
     $com['tipmens'] = $_POST['tipmens'];
     $com['fecvence'] = $_POST['fecvence'];
     $com['categoria'] = $_POST['categoria'];
     $com['documto_id'] = $uid;
     $db = new DB();
     $db->perform('mensajes', $com);
     $this->consecu = $db->lastInsertedId();
     $dest_est = $_POST['dest_est'];
     $dest_prof = $_POST['dest_prof'];
     $this->_setDestinatarios($this->consecu, $dest_est);
     $this->_setDestinatarios($this->consecu, $dest_prof);
     $this->uploadDoc();
     Erudio::cosRedirect('index2.php?com=comunicados');
 }
示例#6
0
 $message = mysql_real_escape_string($_REQUEST['message']);
 $listing_info = $db->queryUniqueObject("SELECT l.headline, u.* FROM listings l\n\t\t\t\t\t\t\t\t\t\t\tLEFT JOIN users u ON u.id = l.user_id\n\t\t\t\t\t\t\t\t\t\t\tWHERE l.id = '{$listing_id}'");
 $user_exists = $db->queryUniqueValue("SELECT id FROM users WHERE email = '{$email}'");
 $emailTemplate = new EmailTemplate();
 // Create an instance for new user from contact form
 if ($user_exists == null) {
     // user doesn't exist so add them
     if (strpos($name, " ") != false) {
         list($fname, $lname) = explode(" ", $name);
     } else {
         $fname = $name;
         $lname = "";
     }
     $password = encode($name, $encode_key);
     $db->query("INSERT INTO users (group_id,first_name,last_name,email,password,active,created) VALUES(2,'{$fname}','{$lname}','{$email}','{$password}',0,NOW())");
     $new_u_id = $db->lastInsertedId();
     // put message into the database
     $db->query("INSERT INTO messages (parent_id,listing_id,from_id,to_id,message,timestamp) VALUES(0,'{$listing_id}','{$new_u_id}','{$listing_info->id}','{$message}',NOW())");
     $inquiry_id = $db->lastInsertedId();
     // send activation email to new user
     $code = encode($email, "businessfieds");
     // encrypt email to make code
     // set template fields
     $emailTemplate->SetParameter("activation_url", '<a href="http://www.businessfieds.com/activation&x=' . $code . '">http://www.businessfieds.com/activation&x=' . $code . '</a>');
     $emailTemplate->SetParamter("inquirer_name", $name);
     $emailTemplate->SetTemplate($settings['new_user_contact_et']);
     $sendNewUEmail = sendMail($email, $email->Subject(), $email->CreateBody());
     // send email
     // send message notifications to inquirer and seller
     $emailTemplate->SetParameter("seller_name", $listing_info->first_name . " " . $listing_info->last_name);
     $emailTemplate->SetParameter("listing_headline", $listing_info->headline);
示例#7
0
 public function setEvaluacion()
 {
     global $uid;
     $data['estudiante_id'] = $uid;
     $data['tutor_id'] = $_POST['tutor_id'];
     $data['curso_id'] = $_POST['curso_id'];
     $data['concepto_tutor'] = $_POST['concepto_tutor'];
     $data['periodo_id'] = CatManUtils::getPeriodoVigente();
     $db = new DB();
     if (!$db->perform('eval_tutores_estu', $data)) {
         Elfic::cosRedirect('index2.php?com=evaluacion', 'Error en el registro. Contacte al administrador');
     } else {
         $eval_id = $db->lastInsertedId();
         $valores = $_POST['respuesta'];
         $aLista = array_keys($_POST['respuesta']);
         foreach ($aLista as $indice) {
             $val = $valores[$indice];
             $sql = "INSERT INTO eval_tutores_resp (eval_id, pregunta_id, respuesta)" . "VALUES ('{$eval_id}', '{$indice}', '{$val}' )";
             $db = new DB();
             $db->execute($sql);
         }
         Elfic::cosRedirect('index2.php?com=evaluacion', 'Los resultados se grabaron satisfactoriamente');
     }
 }
示例#8
0
$row = 1;
$f = fopen("usuarios.csv", "r");
$i = 1;
while ($data = fgetcsv($f, 1000, ";")) {
    $p['nombres'] = $data[0];
    $p['apellidos'] = $data[1];
    $p['login'] = $data[2];
    $p['password'] = Elfic::getCryptedPassword($data[2]);
    $p['email'] = $data[3];
    $p['creado'] = Elfic::now();
    $p['modificado'] = Elfic::now();
    $p['ultimoingreso'] = "";
    $p['activo'] = "1";
    $p['esadmin'] = "0";
    $db = new DB();
    if (!$db->perform('usuarios', $p)) {
        echo "Error creando usuario " . $p['nombres'] . " " . $p['apellidos'];
        echo "\n<br>";
    } else {
        echo "Se creó el usuario " . $p['nombres'] . " " . $p['apellidos'];
        $id = $db->lastInsertedId();
        $db2 = new DB();
        $up['usuario_id'] = $id;
        $up['usuarios_grupo_id'] = 4;
        $db2->perform('usuarios_grupos_links', $up);
        echo " - ";
        echo "Se agreg&oacute; al grupo";
        echo "\n<br>";
    }
}
fclose($f);
示例#9
0
 /**
  * @desc Registra datos básicos de un Usuario. Insert o Update
  * @param string $action "new" para nuevo
  * @return void
  */
 public function save($action = null)
 {
     $db = new DB();
     $data = array();
     $data['catedra_id'] = $db->sqlInput($_REQUEST['catedra_id'], 'int');
     $data['grupo'] = $db->sqlInput($_REQUEST['grupo'], 'text');
     $data['tutor_id'] = $db->sqlInput($_REQUEST['tutor_id'], 'int');
     $data['periodo_id'] = $db->sqlInput($_REQUEST['periodo_id'], 'int');
     $data['dia'] = $db->sqlInput($_REQUEST['dia'], 'int');
     $data['hora'] = $db->sqlInput($_REQUEST['hora'], 'text');
     $data['estado'] = $db->sqlInput($_REQUEST['estado'], 'int');
     if ($action == "new") {
         $db->perform('cursos', $data);
         $id = $db->lastInsertedId();
         $msg = MSG_CURSO_CREADO;
     } else {
         $id = $db->sqlInput($_REQUEST['cid'], 'int');
         $db->perform('cursos', $data, 'update', 'id=' . $id);
         $msg = MSG_CURSO_UPDATE;
     }
     $url = "index2.php?com=cursos&do=view&cid=" . $id;
     Elfic::cosRedirect($url, $msg);
     var_dump($data);
 }
示例#10
0
        $target = (int) $_POST['target'];
    } else {
        $target = 1;
    }
    if (isset($_POST['assign']) && (int) $_POST['assign'] >= 0) {
        $assign = (int) $_POST['assign'];
    } else {
        $assign = 1;
    }
    if (isset($_POST['status']) && (int) $_POST['status'] == 'closed') {
        $status = 'closed';
    } else {
        $status = 'open';
    }
    if (isset($_POST['due'])) {
        $due = $_POST['due'];
    } else {
        $due = date("Y-m-d");
    }
    $added = date("Y-m-d");
    if (DBIssues::addIssue($type, $name, $details, $target, $assign, $due, $added, $added, $status, $author)) {
        Session::addMessage('Issue Added Successfully');
        header("Location: " . $cfg['domain'] . $cfg['site_path'] . 'issues_detail.php?id=' . DB::lastInsertedId());
    } else {
        Session::addMessage("An Error Occurred");
        header("Location: " . $cfg['domain'] . $cfg['site_path'] . 'issues_add.php');
    }
    exit;
}
$tpl = TemplateEngine::templateFromFile('content/issues_add');
TemplateEngine::output($tpl, new IssuesData());