/**
  * Ajouter un besoin
  * @param ABesoin $a_besoin, le besoin à ajouter
  */
 public function AddBesoin(Besoin $a_besoin)
 {
     Array_Push($this->_besoins, $a_besoin);
     $this->_nbBesoins++;
     try {
         $this->EstPret();
     } catch (Exception $e) {
     }
 }
 /**
  * Ajouter un besoin
  * @param ABesoin $a_besoin, l'action à ajouter
  */
 public function AddBesoin($a_besoin)
 {
     if ($a_besoin instanceof ABesoin) {
         Array_Push($this->_needs, $a_besoin);
     }
     try {
         $this->EstPret();
     } catch (Exception $e) {
     }
 }
 // 1. 按照 \n 切开
 $tmp = explode("\n", $newUsersBatchInput);
 $tmp_count = count($tmp);
 // 2. 按照 工号,姓名,Email 取出, 放入 Array
 $result = array();
 for ($i = 0; $i < $tmp_count; $i++) {
     $ret = explode(',', $tmp[$i]);
     if (count($ret) != 6 || strlen($ret[0]) == 0 || strlen($ret[1]) == 0 || strlen($ret[2]) == 0 || strlen($ret[3]) == 0 || strlen($ret[4]) == 0 || strlen($ret[5]) == 0) {
         echo "-- 第" . ($i + 1) . "笔数据格式错误 -- " . $tmp[$i];
         return;
     }
     if (check_email($ret[2]) != SUCCESS) {
         echo "-- 第" . ($i + 1) . "笔数据 Email 格式错误 -- " . $tmp[$i];
         return;
     }
     Array_Push($result, $ret);
 }
 // 3. Transaction begin
 mysqli_autocommit($link, FALSE);
 // 4. For each row in Array, Insert, Rollback if failed
 $result_count = count($result);
 for ($i = 0; $i < $result_count; $i++) {
     $EmployeeId = $result[$i][0];
     $UserName = $result[$i][1];
     $UserEmail = $result[$i][2];
     $UserWId = $result[$i][3];
     $UserDeptId = detp_id($result[$i][4]);
     $UserCheckInTime = date("Y/m/d", strtotime($result[$i][5]));
     $sql_str = "Insert into Users (UserName,Email,EmployeeId,Status,CanApprove,JobGrade,CreatedUser,CreatedTime,EditUser,EditTime,UserWId,DeptId,CheckInTime)" . " VALUES('{$UserName}','{$UserEmail}','{$EmployeeId}',1,0,1,{$user_id},now(),{$user_id},now(),'{$UserWId}',{$UserDeptId},'{$UserCheckInTime}');";
     if (!mysqli_query($link, $sql_str)) {
         mysqli_rollback($link);
Beispiel #4
0
function GetElemPropertyNames(&$cfg_elem)
{
    $prop_names = array();
    foreach ($info as $key => $value_array) {
        Array_Push($prop_names, $key);
    }
}
Beispiel #5
0
function GetTemplate(&$file = 0)
{
    print " * Loading template file...\n";
    if (!$file) {
        $file = "template.cfg";
    }
    $cfg_file = ReadConfigFile($file);
    if ($cfg_file == FALSE) {
        print "Cant open template {$file} ({$php_errormsg}).\n";
        exit;
    }
    $template = FindConfigElem($cfg_file, "Template");
    if ($template == FALSE) {
        print "Cant find elem 'Template'.\n";
        exit;
    } else {
        $order = array();
        foreach ($template as $key => $value) {
            Array_Push($order, $key);
        }
        return $order;
    }
}