예제 #1
0
파일: member.php 프로젝트: byyeong/dc2016
 public function edit()
 {
     $this->assigns_layout["sideb"] = "edit";
     if (!$_SESSION["s"]) {
         header("Location: /login?next=/member/edit");
     }
     if ($_REQUEST["email"]) {
         $_REQUEST["public_act"] = 0;
         if ($_REQUEST["public_act1"]) {
             $_REQUEST["public_act"] = $_REQUEST["public_act"] + 1;
         }
         if ($_REQUEST["public_act2"]) {
             $_REQUEST["public_act"] = $_REQUEST["public_act"] + 2;
         }
         $_id = $this->Members->add($_REQUEST);
         if ($_REQUEST["pic"]) {
             $img_temp_name = str_replace(" ", "", $_REQUEST['pic']);
             $ck = substr($img_temp_name, 0, 1);
             if ($ck == '/') {
                 $img_temp_name = substr($img_temp_name, 1, strlen($img_temp_name) - 1);
             }
             $file_ext = explode('.', $img_temp_name);
             //$filename = basename($_FILES['file']['name']);
             $file_ext = '.' . $file_ext[sizeof($file_ext) - 1];
             $original_file = $this->settings->root_path . $img_temp_name;
             $copy_file = $this->settings->root_path . 'media/member/' . $_id . $file_ext;
             //그림 파일 update 폴더로 옮긴 후 임시파일 삭제
             copy($original_file, $copy_file);
             unlink($original_file);
             $_pic = '/media/member/' . $_id . $file_ext;
             $this->Members->add_picture($_id, $_pic);
         }
         if ($_REQUEST["local"]) {
             if ($_REQUEST["id"]) {
                 $this->Member_local->delete_by_user($_REQUEST["id"]);
             }
             $local = explode(",", $_REQUEST["local"]);
             $len_local = sizeof($local);
             for ($i = 0; $i < $len_local; $i++) {
                 if (trim($local[$i])) {
                     $this->Member_local->add($_id, trim($local[$i]));
                 }
             }
         }
         if ($_REQUEST["id"]) {
             $this->Member_local->delete_by_user($_REQUEST["id"]);
             $this->Member_interist->delete_by_user($_REQUEST["id"]);
             $this->Member_inv->delete_by_user($_REQUEST["id"]);
             $this->Member_skill->delete_by_user($_REQUEST["id"]);
             $this->Member_market->delete_by_user($_REQUEST["id"]);
         }
         // utype == 1
         if ($_REQUEST["local"]) {
             $local = explode(",", $_REQUEST["local"]);
             $len_local = sizeof($local);
             for ($i = 0; $i < $len_local; $i++) {
                 if (trim($local[$i])) {
                     $this->Member_local->add($_id, trim($local[$i]));
                 }
             }
         }
         if ($_REQUEST["inter_"]) {
             $int = explode(",", $_REQUEST["inter_"]);
             $len_int = sizeof($int);
             for ($n = 0; $n < $len_int; $n++) {
                 if (trim($int[$n])) {
                     $this->Member_interist->add_c($_id, trim($int[$n]));
                 }
             }
         }
         $len_sk = $_REQUEST["cnt_sk"];
         for ($j = 1; $j < $len_sk + 1; $j++) {
             $tmp = "skill_" . $j;
             if (trim($_REQUEST[$tmp])) {
                 $val = $this->Code->get_value(trim($_REQUEST[$tmp]), 'jobs');
                 $this->Member_skill->add_c($_id, $val['id']);
             }
         }
         // utype == 2
         $len_int = $_REQUEST["cnt_fl_i"];
         for ($k = 1; $k < $len_int + 1; $k++) {
             $tmp = "field_" . $k;
             if (trim($_REQUEST[$tmp])) {
                 $val = $this->Code->get_value(trim($_REQUEST[$tmp]), 'jobs');
                 $this->Member_inv->add($_id, $val['id']);
             }
         }
         $len_sk_i = $_REQUEST["cnt_sk_i"];
         for ($l = 1; $l < $len_sk_i + 1; $l++) {
             $tmp = "skill_" . $l;
             if (trim($_REQUEST[$tmp])) {
                 $val = $this->Code->get_value(trim($_REQUEST[$tmp]), 'jobs');
                 $this->Member_skill->add_c($_id, $val['id']);
             }
         }
         $len_mk_i = $_REQUEST["cnt_mk_i"];
         for ($m = 1; $m < $len_mk_i + 1; $m++) {
             $tmp = "market_" . $m;
             if (trim($_REQUEST[$tmp])) {
                 $val = $this->Code->get_value(trim($_REQUEST[$tmp]), 'market');
                 $this->Member_market->add_c($_id, $val['id']);
             }
         }
         // activity
         $m = "<a href='/member/" . $_REQUEST["ids"] . "'>" . $_REQUEST["name"] . "</a>님이 프로필 정보를 수정하였습니다.";
         add_activity(1, $_REQUEST["id"], 1, $_REQUEST["id"], "", $m);
         unset($_SESSION["s"]);
         $_SESSION["s"] = $this->Members->get($_id);
         $_SESSION["s"]["fb"] = $this->Member_ext->get_by_user_id_type($_id, 1);
         $_SESSION["s"]["tw"] = $this->Member_ext->get_by_user_id_type($_id, 2);
         $this->assigns_layout["msg"] = "수정되었습니다.";
     }
     $res = $this->Members->get($_SESSION["s"]["id"]);
     $this->assigns["res"] = $res;
     $this->assigns["tw"] = $this->Member_ext->get_by_user_id_type($_SESSION["s"]["id"], Member_ext_model::TWITTER_TYPE);
     $this->assigns["fb"] = $this->Member_ext->get_by_user_id_type($_SESSION["s"]["id"], Member_ext_model::FACEBOOK_TYPE);
     $res_lo = $this->Member_local->get_by_member($_SESSION["s"]["id"]);
     $this->assigns["res_sk"] = $this->Member_skill->get_by_member_c($_SESSION["s"]["id"]);
     if ($res["utype"] == 1) {
         $this->assigns["res_in"] = $this->Member_interist->get_by_member_c($_SESSION["s"]["id"]);
         $inv = $this->Code->get_by_key('inv');
         for ($v = 0; $v < sizeof($inv); $v++) {
             for ($vv = 0; $vv < sizeof($this->assigns["res_in"]); $vv++) {
                 if ($inv[$v]["id"] == $this->assigns["res_in"][$vv]["interist_id"]) {
                     $inv[$v]['checked'] = true;
                 }
             }
         }
         $this->assigns["inv"] = $inv;
     } else {
         if ($res["utype"] == 2) {
             $this->assigns["res_mk"] = $this->Member_market->get_by_member_c($res["id"]);
             $this->assigns["res_in"] = $this->Member_inv->get_by_member($res["id"]);
         }
     }
     $loc = $this->Code->get_by_key('local');
     for ($l = 0; $l < sizeof($loc); $l++) {
         for ($ll = 0; $ll < sizeof($res_lo); $ll++) {
             if ($loc[$l]["id"] == $res_lo[$ll]["local_id"]) {
                 $loc[$l]['checked'] = true;
             }
         }
     }
     $this->assigns["local"] = $loc;
     $this->assigns["res_lo"] = $res_lo;
     $_key = 'field';
     $result = $this->Code->get_by_key($_key);
     $items = array();
     for ($i = 0; $i < sizeof($result); $i++) {
         $result[$i]["value"] = $result[$i]["_value"];
         array_push($items, $result[$i]);
     }
     $_key2 = 'jobs';
     $result2 = $this->Code->get_by_key($_key2);
     $items2 = array();
     for ($j = 0; $j < sizeof($result2); $j++) {
         $result2[$j]["value"] = $result2[$j]["_value"];
         array_push($items2, $result2[$j]);
     }
     $_key3 = 'market';
     $result3 = $this->Code->get_by_key($_key3);
     $items3 = array();
     for ($j = 0; $j < sizeof($result3); $j++) {
         array_push($items3, $result3[$j]["_value"]);
     }
     $this->assigns["market"] = json_encode($items3);
     $this->assigns["job"] = json_encode($items2);
     $this->assigns["skill"] = json_encode($items2);
 }
예제 #2
0
파일: timelog.php 프로젝트: bbogin/sr2s
function new_hours(&$state)
{
    $logdate = clone $state->from_date;
    if ($state->columns < 0 && $state->row == 0) {
        //add a rec in list style
        if (!audit_date($state, $logdate)) {
            return;
        }
    }
    $status = array();
    if (!audit_hours($state, $logdate, $status)) {
        return;
    }
    //adding a row but didn't select existing activity:
    if ($state->row == 0 && $state->activity_id == 0) {
        add_activity($state);
    }
    for ($ndx = 0; $ndx < abs($state->columns); $ndx++, $logdate->add(new DateInterval('P1D'))) {
        switch ($status[$ndx]) {
            case 'a':
                //add
                add_log($state, $logdate, $ndx);
                break;
            case 'u':
                //update
                update_log($state, $logdate, $ndx);
                break;
            case 'd':
                //delete
                delete_log($state, $logdate, $ndx);
                break;
        }
    }
}
예제 #3
0
function currentActivity($type, $url, $cty_id, $description = null)
{
    $uid = '';
    if (!empty($_SESSION['user']['id'])) {
        $uid = $_SESSION['user']['id'];
    } else {
        $uid = null;
    }
    add_activity($uid, $type, $url, $cty_id, $description);
}
예제 #4
0
 public function add($_id = '')
 {
     $this->assigns_layout["gnb_left"] = "add";
     $this->assigns["job"] = $this->Code->get_by_key('job');
     $this->assigns["local"] = $this->Code->get_by_key('local');
     $this->assigns["career"] = $this->Code->get_by_key('career');
     $this->assigns["field"] = $this->Code->get_by_key('field', '', 'id < 20');
     $this->assigns["period"] = $this->Code->get_by_key('period');
     $this->assigns["lang"] = $this->Code->get_by_key('lang');
     $this->assigns["inv"] = $this->Code->get_by_key('inv');
     $_key = 'field';
     $result = $this->Code->get_by_key($_key);
     $items = array();
     for ($i = 0; $i < sizeof($result); $i++) {
         $result[$i]["value"] = $result[$i]["_value"];
         array_push($items, $result[$i]);
     }
     $this->assigns["job"] = json_encode($items);
     if ($_REQUEST["user_id"]) {
         if ($_REQUEST["contents"]) {
             $_REQUEST["contents"] = str_replace('"../../', '"' . '/', $_REQUEST["contents"]);
             $_REQUEST["contents"] = str_replace('"../', '"' . '/', $_REQUEST["contents"]);
         }
         $startup = $this->Startup->get_by_name($_REQUEST["company"]);
         $_REQUEST["startup_id"] = $startup["id"];
         $id = $this->Recruit->add($_REQUEST);
         $this->Recruit_opt->delete_by_recruit($id);
         if ($_REQUEST["t_local"]) {
             $local = explode(",", $_REQUEST["t_local"]);
             $len_local = sizeof($local);
             for ($i = 0; $i < $len_local; $i++) {
                 if (trim($local[$i])) {
                     $this->Recruit_opt->add($id, trim($local[$i]), 1);
                 }
             }
         }
         if ($_REQUEST["t_career"]) {
             $career = explode(",", $_REQUEST["t_career"]);
             $len_career = sizeof($career);
             for ($j = 0; $j < $len_career; $j++) {
                 if (trim($career[$j])) {
                     $this->Recruit_opt->add($id, trim($career[$j]), 2);
                 }
             }
         }
         if ($_REQUEST["t_field"]) {
             $field = explode(",", $_REQUEST["t_field"]);
             $len_field = sizeof($field);
             for ($k = 0; $k < $len_field; $k++) {
                 if (trim($field[$k])) {
                     $this->Recruit_opt->add($id, trim($field[$k]), 3);
                 }
             }
         }
         if ($_REQUEST["t_period"]) {
             $period = explode(",", $_REQUEST["t_period"]);
             $len_period = sizeof($period);
             for ($l = 0; $l < $len_period; $l++) {
                 if (trim($period[$l])) {
                     $this->Recruit_opt->add($id, trim($period[$l]), 4);
                 }
             }
         }
         if ($_REQUEST["t_lang"]) {
             $lang = explode(",", $_REQUEST["t_lang"]);
             $len_lang = sizeof($lang);
             for ($m = 0; $m < $len_lang; $m++) {
                 if (trim($lang[$m])) {
                     $this->Recruit_opt->add($id, trim($lang[$m]), 5);
                 }
             }
         }
         $len_j = $_REQUEST["cnt_j"];
         for ($n = 1; $n < $len_j + 1; $n++) {
             $tmp = "job_" . $n;
             if (trim($_REQUEST[$tmp])) {
                 $val = $this->Code->get_value(trim($_REQUEST[$tmp]), 'field');
                 $this->Recruit_opt->add($id, $val['id'], '6');
             }
         }
         if ($_REQUEST["t_inv"]) {
             $in = explode(",", $_REQUEST["t_inv"]);
             $len_in = sizeof($in);
             for ($ii = 0; $ii < $len_in; $ii++) {
                 if (trim($in[$ii])) {
                     $this->Recruit_opt->add($id, trim($in[$ii]), 7);
                 }
             }
         }
         if (!$_REQUEST["id"]) {
             $this->assigns["ok"] = TRUE;
             $s = $this->Startup->get($_REQUEST["startup_id"]);
             $_msg = "<a href='/startup/" . $s["id"] . "'>" . $s["name"] . "</>에서 <a href='/recruit/views/" . $id . "'>채용공고</a>를 작성했습니다.";
             add_activity(2, $_REQUEST["startup_id"], 2, $_REQUEST["startup_id"], '', $_msg);
         } else {
             $this->assigns["msg"] = "수정되었습니다.";
             if ($_REQUEST["state"] == 1) {
                 // mailing code
                 $this->Code->get_value($id, "rec_m");
             }
         }
     }
     if ($_id) {
         $res = $this->Recruit->get($_id);
         $this->assigns["res"] = $res;
         $e_lo = $this->Recruit_opt->get_detail($_id, 1, 1);
         $e_ca = $this->Recruit_opt->get_detail($_id, 2, 1);
         $e_fi = $this->Recruit_opt->get_detail($_id, 3, 1);
         $e_pe = $this->Recruit_opt->get_detail($_id, 4, 1);
         $e_la = $this->Recruit_opt->get_detail($_id, 5, 1);
         $e_jo = $this->Recruit_opt->get_detail($_id, 6);
         $e_in = $this->Recruit_opt->get_detail($_id, 7, 1);
         $this->assigns["e_lo"] = $e_lo["_value"];
         $this->assigns["e_ca"] = $e_ca["_value"];
         $this->assigns["e_fi"] = $e_fi["_value"];
         $this->assigns["e_pe"] = $e_pe["_value"];
         $this->assigns["e_la"] = $e_la["_value"];
         $this->assigns["e_jo"] = $e_jo;
         $this->assigns["e_inv"] = $e_in["_value"];
     } else {
         $this->assigns["con"] = '<div>
             <div>* 아래 입력 사항을 준수하여 채용 공고를 작성해 주세요.&nbsp;</div>
             <div>&nbsp; 정보가 부족한 경우에는 &nbsp;승인이 어렵습니다. ^^</div>
             </div>
             <div>&nbsp;</div>
             <div>1. 사업 소개</div>
             <div>&nbsp;</div>
             <div>2. 회사 소개</div>
             <div>&nbsp;</div>
             <div>3. 모집 부분 및 인원, 지원 자격</div>
             <div>&nbsp;</div>
             <div>4. 근무 조건 및 복지제도</div>
             <div>&nbsp;</div>
             <div>5. 지원 방법</div>
             <div>&nbsp;</div>
             <div>6. 근무지역 &nbsp;</div>
             <div>&nbsp;</div>
             <div>7. 유의사항</div>
             <div>&nbsp;</div>
             <div>8. 기타</div>';
     }
 }
예제 #5
0
파일: tasks.php 프로젝트: Xackery/EQEmuEOC
     exit;
 case 9:
     // Get activity ID
     check_authorization();
     $body = new Template("templates/tasks/activity.add.tmpl.php");
     $body->set('tskid', $_GET['tskid']);
     $body->set('rewardmethods', $rewardmethods);
     $body->set('activitytypes', $activitytypes);
     $body->set('zoneids', $zoneids);
     $body->set('suggestid', suggest_activity_id());
     $body->set('suggeststep', suggest_step());
     break;
 case 10:
     // Add activity
     check_authorization();
     add_activity();
     $tskid = $_POST['taskid'];
     header("Location: index.php?editor=tasks&tskid={$tskid}");
     exit;
 case 11:
     // View goallist info
     $body = new Template("templates/tasks/goallist.tmpl.php");
     $body->set('tskid', $_GET['tskid']);
     $body->set('lid', $_GET['lid']);
     $body->set('atype', $_GET['atype']);
     $vars = get_goallist();
     if ($vars) {
         foreach ($vars as $key => $value) {
             $body->set($key, $value);
         }
     }
예제 #6
0
function change_activity(&$state)
{
    global $_DB;
    if ($state->activity_id == 0) {
        //creating a new one
        add_activity($state);
    } else {
        activity_list($state);
        //restore the record list
        if (!array_key_exists($state->activity_id, $state->records)) {
            throw_the_bum_out(NULL, "Evicted(" . __LINE__ . "): invalid activity id " . $state->activity_id, true);
        }
    }
    log_list($state, $state->row);
    //find this row's records
    $record = reset($state->records);
    $old_activity = $record["activity_id"];
    if ($state->activity_id == $old_activity) {
        return;
    }
    foreach ($state->records as $ID => $record) {
        if ($record["column"] < $state->columns[COL_OPEN]) {
            continue;
        }
        $sql = "UPDATE " . $_DB->prefix . "b00_timelog\n\t\t\t\tSET activity_idref=" . $state->activity_id . " WHERE timelog_id=" . $ID . ";";
        $_DB->exec($sql);
    }
    $sql = "SELECT COUNT(*) AS count FROM " . $_DB->prefix . "b00_timelog WHERE activity_idref=" . $old_activity . "";
    $stmt = $_DB->query($sql);
    if ($stmt->fetchObject()->count == 0) {
        $sql = "DELETE FROM " . $_DB->prefix . "b02_activity WHERE activity_id=" . $old_activity . "";
        $_DB->exec($sql);
    }
    $stmt->closeCursor();
}
예제 #7
0
 public function reserve($_id = '')
 {
     if (!$_SESSION["s"]["membership"]) {
         header("Location: /");
     }
     if ($_REQUEST["date"]) {
         $this->Space_reserve->debug();
         $s_r_id = $this->Space_reserve->add($_REQUEST);
         //            add_activity(1, $_REQUEST["user_id"], 1, $_REQUEST["user_id"], 0, "", Activity_model::A_TYPE_SPACE, $s_r_id);
         //            $_SESSION["msg"] = "공간공유가 신청되었습니다.<br />관리자 승인이 완료되면 공간공유 페이지에 노출됩니다.";
         $sp = $this->Space->get($_REQUEST["space_id"]);
         if ($sp["type"] > 2 && ($_SESSION["s"]["per"] & $this->settings->permission7) == $this->settings->permission7) {
             $tmp = $this->Members->get_etc("_key = 'permission7' and user_id = " . $_SESSION["s"]["id"]);
             if ($_REQUEST["date"] > $tmp["_value"] && $_REQUEST["rest"] >= timeDiff($_REQUEST["start"], $_REQUEST["end"])) {
                 $this->assigns["ok"] = 2;
                 add_activity(1, $_REQUEST["user_id"], 1, $_REQUEST["user_id"], 1, "", Activity_model::A_TYPE_SPACE, $s_r_id);
                 $_SESSION["msg"] = "예약 신청되었습니다.";
                 $ar["state"] = 1;
                 $this->Space_reserve->permit($s_r_id, $ar);
             } else {
                 $this->assigns["ok"] = 1;
                 add_activity(1, $_REQUEST["user_id"], 1, $_REQUEST["user_id"], 0, "", Activity_model::A_TYPE_SPACE, $s_r_id);
                 $_SESSION["msg"] = "예약 신청되었습니다.<br />관리자 승인이 완료되면 Reservation 페이지에 노출됩니다.";
             }
         } else {
             if ($sp["type"] == 3 && ($_SESSION["s"]["per"] & $this->settings->permission8) == $this->settings->permission8) {
                 $this->assigns["ok"] = 2;
                 add_activity(1, $_REQUEST["user_id"], 1, $_REQUEST["user_id"], 1, "", Activity_model::A_TYPE_SPACE, $s_r_id);
                 $_SESSION["msg"] = "예약 신청되었습니다.";
                 $ar["state"] = 1;
                 $this->Space_reserve->permit($s_r_id, $ar);
             } else {
                 $this->assigns["ok"] = 1;
                 add_activity(1, $_REQUEST["user_id"], 1, $_REQUEST["user_id"], 0, "", Activity_model::A_TYPE_SPACE, $s_r_id);
                 $_SESSION["msg"] = "예약  신청되었습니다.<br />관리자 승인이 완료되면 Reservation 페이지에 노출됩니다.";
             }
         }
         header("Location: /member/edit_space");
     }
     if ($_id) {
         $res = $this->Space_reserve->get($_id);
         if ($res["user_id"] == $_SESSION["s"]["id"]) {
             $this->assigns["res"] = $res;
         } else {
             header("Location: /");
         }
     }
     if ($_REQUEST["cancel"]) {
         $this->Space_reserve->delete($_REQUEST["cancel"]);
         header("Location: /member/edit_space");
     }
     $this->assigns["space"] = $this->Space->list_(1, 100, "visible = 1");
     //        print_r($_REQUEST);
     //        echo "/".timeDiff($_REQUEST["start"], $_REQUEST["end"]);
 }
예제 #8
0
파일: event.php 프로젝트: byyeong/dc2016
 public function add_process()
 {
     $payment = 0;
     if (array_key_exists('payment1', $_REQUEST)) {
         $payment = $payment | $this->settings->payment1;
     } else {
         $payment = $payment & ~$this->settings->payment1;
     }
     if (array_key_exists('payment2', $_REQUEST)) {
         $payment = $payment | $this->settings->payment2;
     } else {
         $payment = $payment & ~$this->settings->payment2;
     }
     if (array_key_exists('payment3', $_REQUEST)) {
         $payment = $payment | $this->settings->payment3;
     } else {
         $payment = $payment & ~$this->settings->payment3;
     }
     if (array_key_exists('payment4', $_REQUEST)) {
         $payment = $payment | $this->settings->payment4;
     } else {
         $payment = $payment & ~$this->settings->payment4;
     }
     $_REQUEST['payment'] = $payment;
     if ($_REQUEST["space"] == 0) {
         $_REQUEST["space_id"] = 0;
     } else {
         $_REQUEST["space_etc"] = null;
     }
     $_id = $this->Event->add($_REQUEST);
     if ($_REQUEST["pic"]) {
         $img_temp_name = str_replace(" ", "", $_REQUEST['pic']);
         $ck = substr($img_temp_name, 0, 1);
         if ($ck == '/') {
             $img_temp_name = substr($img_temp_name, 1, strlen($img_temp_name) - 1);
         }
         $file_ext = explode('.', $img_temp_name);
         //$filename = basename($_FILES['file']['name']);
         $file_ext = '.' . $file_ext[sizeof($file_ext) - 1];
         $original_file = $this->settings->root_path . $img_temp_name;
         $copy_file = $this->settings->root_path . 'media/event/' . $_id . $file_ext;
         GD2_make_thumb_x(300, "", $original_file);
         //그림 파일 update 폴더로 옮긴 후 임시파일 삭제
         copy($original_file, $copy_file);
         unlink($original_file);
         $_pic = '/media/event/' . $_id . $file_ext;
         $this->Event->add_picture($_id, $_pic);
     }
     if ($_REQUEST["del_file"]) {
         $this->Event->add_file($_id, '');
         unlink('media/event_file/' . $_REQUEST["del_file"]);
     }
     if ($_FILES["file"]["name"]) {
         $file = make_upload("/media/event_file/", "file");
         if ($file) {
             $this->Event->add_file($_id, $file, $_FILES["file"]["name"]);
         }
     }
     add_activity(1, $_REQUEST["user_id"], 1, $_REQUEST["user_id"], 0, "", Activity_model::A_TYPE_EVENT, $_id, 1);
     $_SESSION["msg"] = "이벤트가 신청되었습니다.<br />관리자 승인이 완료되면 이벤트 페이지에 노출됩니다.";
     header("Location: /member/edit_event_m");
 }
예제 #9
0
 public function event_apply()
 {
     if ($_REQUEST["enroll"] == 1 && $_REQUEST["enroll_type"] == 1 && ($_REQUEST["cnt"] == 0 || $_REQUEST["cnt"] > $_REQUEST["rcnt"])) {
         $_REQUEST["state"] = 1;
     } else {
         $_REQUEST["state"] = 0;
     }
     $result["id"] = $this->Event_reserve->add($_REQUEST);
     add_activity(1, $_REQUEST["user_id"], 1, $_REQUEST["user_id"], $_REQUEST["state"], "", Activity_model::A_TYPE_EVENT, $_REQUEST["event_id"]);
     $e = $this->Event->get($_REQUEST["event_id"]);
     if ($e["enroll_type"] == 1) {
         $e_cnt = $this->Event_reserve->cnt("event_id = " . $_REQUEST["event_id"]);
         if ($e["cnt"] > $e_cnt) {
             $arr["act_type"] = Activity_model::C_TYPE_MEMBER;
             $arr["act_id"] = $_REQUEST["user_id"];
             $arr["target_type"] = Activity_model::A_TYPE_EVENT;
             $arr["target_id"] = $_REQUEST["event_id"];
             $arr["act_result"] = 1;
             $this->Activity->edit($arr);
             $ev = $this->Event->get_detail($_REQUEST["event_id"]);
             $u = $this->Members->get($_REQUEST["user_id"]);
             $m = new TF_mailer($this->settings);
             $m->mailto = $u["email"];
             $m->subject = "[D.CAMP] <" . $ev["title"] . "> 참가 신청이 승인되었습니다.";
             $m->tpl_name = "event_apply";
             $m->assigns["res"] = $ev;
             $m->assigns["main_service_url"] = $this->globals->my_host;
             $m->assigns["main_service_domain"] = $_SERVER['SERVER_NAME'];
             $m->send();
         }
     }
     $this->tpl_name = "";
     echo json_encode($result);
 }
예제 #10
0
파일: startup.php 프로젝트: byyeong/dc2016
 public function edit($_id)
 {
     if (!$this->Startup_member->get_first($_id, $_SESSION["s"]["id"])) {
         header("Location: /startup/" . $_id);
     }
     if ($_REQUEST["id"]) {
         if ($_REQUEST["name"] && $_REQUEST["bio"]) {
             $_REQUEST["state"] = 1;
         }
         $_id = $this->Startup->add($_REQUEST);
         $this->Startup_tech->delete_by_user($_REQUEST["id"]);
         $len_sk = $_REQUEST["cnt_sk"];
         for ($j = 1; $j < $len_sk + 1; $j++) {
             $tmp = "skill_" . $j;
             if (trim($_REQUEST[$tmp])) {
                 $val = $this->Code->get_value(trim($_REQUEST[$tmp]), 'jobs');
                 $this->Startup_tech->add_c($_id, $val['id']);
             }
         }
         $this->Startup_bussiness->delete_by_user($_REQUEST["id"]);
         $len_int = $_REQUEST["cnt_int"];
         for ($k = 1; $k < $len_int + 1; $k++) {
             $tmp = "inter_" . $k;
             if (trim($_REQUEST[$tmp])) {
                 $val = $this->Code->get_value(trim($_REQUEST[$tmp]), 'field');
                 $this->Startup_bussiness->add_c($_id, $val['id']);
             }
         }
         if ($_REQUEST["img"]) {
             $img_temp_name = str_replace(" ", "", $_REQUEST['img']);
             $ck = substr($img_temp_name, 0, 1);
             if ($ck == '/') {
                 $img_temp_name = substr($img_temp_name, 1, strlen($img_temp_name) - 1);
             }
             $file_ext = explode('.', $img_temp_name);
             //$filename = basename($_FILES['file']['name']);
             $file_ext = '.' . $file_ext[sizeof($file_ext) - 1];
             $original_file = $this->settings->root_path . $img_temp_name;
             $copy_file = $this->settings->root_path . 'media/startup/' . $_id . $file_ext;
             //그림 파일 update 폴더로 옮긴 후 임시파일 삭제
             copy($original_file, $copy_file);
             unlink($original_file);
             $_pic = '/media/startup/' . $_id . $file_ext;
             $this->Startup->add_picture($_id, $_pic);
         }
         $mem = $this->Startup->get($_REQUEST["id"]);
         $m = "<a href='/startup/" . $mem["id"] . "'>" . $mem["name"] . "</a>님이 프로필 정보를 수정하였습니다.";
         add_activity(2, $mem["id"], 2, $mem["id"], "", $m);
         $_SESSION["msg"] = "수정되었습니다.";
         header("Location: /startup/" . $_REQUEST["id"]);
     }
     $res = $this->Startup->get($_id);
     $this->assigns["res"] = $res;
     $this->assigns["res_sk"] = $this->Startup_tech->get_by_member_c($_id);
     $this->assigns["res_in"] = $this->Startup_bussiness->get_by_member_c($_id);
     $_key = 'field';
     $result = $this->Code->get_by_key($_key);
     $items = array();
     for ($i = 0; $i < sizeof($result); $i++) {
         $result[$i]["value"] = $result[$i]["_value"];
         array_push($items, $result[$i]);
     }
     $_key2 = 'jobs';
     $result2 = $this->Code->get_by_key($_key2);
     $items2 = array();
     for ($j = 0; $j < sizeof($result2); $j++) {
         $result2[$j]["value"] = $result2[$j]["_value"];
         array_push($items2, $result2[$j]);
     }
     $this->assigns["job"] = json_encode($items2);
     $this->assigns["skill"] = json_encode($items1);
 }
예제 #11
0
 public function apply($_id, $_per = '')
 {
     if (!$_id) {
         header("Location: /error_404");
     }
     $res = $this->Competitions->get($_id);
     $file = $this->Competitions_file->get_by_comp($_id);
     $my = $this->Competitions_apply->get_by_user($_id, $_SESSION["s"]["id"]);
     if ($my && !$_per) {
         $_SESSION["msg"] = "이미 참가신청이 접수되었습니다.";
         header("Location: /challenge/views/" . $_id . "/" . $_per);
     }
     if ($_REQUEST["user_id"]) {
         $_per = $this->Competitions_apply->add($_REQUEST);
         if ($file) {
             $len_file = sizeof($file);
             for ($i = 0; $i < $len_file; $i++) {
                 $f = null;
                 if ($_FILES["file_" . $file[$i]["id"]]["name"]) {
                     $f = make_upload("/media/comp_file/", "file_" . $file[$i]["id"]);
                     $_ar["file"] = $f;
                     $_ar["c_file_id"] = $file[$i]["id"];
                     $_ar["apply_id"] = $_per;
                     $this->Competitions_files->add($_ar);
                     if ($_REQUEST["o_file_" . $file[$i]["id"]]) {
                         unlink($this->settings->root_path . "media/comp_file/" . $_REQUEST["o_file_" . $file[$i]["id"]]);
                     }
                 }
             }
         }
         // activity
         if (!$_REQUEST["id"]) {
             add_activity(1, $_REQUEST["user_id"], 1, $_REQUEST["user_id"], 0, "", Activity_model::E_TYPE_COMPETITION, $_REQUEST["competition_id"], 0);
         }
         $_SESSION["msg"] = "경진 대회 참가 신청이 접수되었습니다.";
         header("Location: /member/edit_challenge/");
         exit(1);
     }
     if ($_per) {
         $per = $this->Competitions_apply->get($_per);
         if ($per["user_id"] != $_SESSION["s"]["id"]) {
             header("Location: /error_404");
         }
         if ($_REQUEST["req"] == 'del') {
             if ($per["user_id"] == $_SESSION["s"]["id"]) {
                 $this->Competitions_apply->delete($_per);
                 $fi = $this->Competitions_files->get_by_apply($_per);
                 for ($ff = 0; $ff < sizeof($fi); $ff++) {
                     unlink("media/comp_file/" . $fi[$ff]["file"]);
                 }
                 header("Location: /member/edit_challenge");
             } else {
                 $this->assigns_layout["msg"] = "삭제 권한이 없습니다.";
             }
         }
         $this->assigns["per"] = $per;
     }
     if ($_SESSION["msg"]) {
         $this->assigns_layout["msg"] = $_SESSION["msg"];
         unset($_SESSION["msg"]);
     }
     if ($_per && $file) {
         for ($j = 0; $j < sizeof($file); $j++) {
             $f = $this->Competitions_files->get_by_file_user($file[$j]["id"], $_per);
             $file[$j][val] = $f["file"];
         }
     }
     $res["form_file"] = $file;
     $this->assigns["res"] = $res;
     $this->sub();
 }