Пример #1
0
 public function actionExport()
 {
     $contactids = EnvUtil::getRequest("contactids");
     $contactArr = ResumeContact::model()->fetchAll("FIND_IN_SET(contactid, '{$contactids}')");
     $fieldArr = array(Ibos::lang("Name"), Ibos::lang("Contact date"), Ibos::lang("Contact staff"), Ibos::lang("Contact method"), Ibos::lang("Contact purpose"), Ibos::lang("Content"));
     $str = implode(",", $fieldArr) . "\n";
     foreach ($contactArr as $contact) {
         $realname = ResumeDetail::model()->fetchRealnameByResumeid($contact["resumeid"]);
         $input = User::model()->fetchRealnameByUid($contact["input"]);
         $inputtime = empty($contact["inputtime"]) ? "" : date("Y-m-d", $contact["inputtime"]);
         $method = $contact["contact"];
         $purpose = $contact["purpose"];
         $detail = $contact["detail"];
         $str .= $realname . "," . $inputtime . "," . $input . "," . $method . "," . $purpose . "," . $detail . "\n";
     }
     $outputStr = iconv("utf-8", "gbk//ignore", $str);
     $filename = date("Y-m-d") . mt_rand(100, 999) . ".csv";
     FileUtil::exportCsv($filename, $outputStr);
 }
Пример #2
0
 public function actionDel()
 {
     if (Ibos::app()->request->isAjaxRequest) {
         $resumeids = EnvUtil::getRequest("resumeids");
         if (empty($resumeids)) {
             $this->error(Ibos::lang("Parameters error", "error"), $this->createUrl("resume/index"));
         }
         $pk = "";
         if (strpos($resumeids, ",")) {
             $pk = explode(",", trim($resumeids, ","));
         } else {
             $pk = $resumeids;
         }
         $delSuccess = Resume::model()->deleteByPk($pk);
         if ($delSuccess) {
             ResumeContact::model()->deleteAll("FIND_IN_SET(resumeid,'{$resumeids}') ");
             ResumeInterview::model()->deleteAll("FIND_IN_SET(resumeid,'{$resumeids}') ");
             ResumeBgchecks::model()->deleteAll("FIND_IN_SET(resumeid,'{$resumeids}') ");
             $detail = ResumeDetail::model()->fetchAll("FIND_IN_SET(resumeid,'{$resumeids}') ");
             $avataridArr = ConvertUtil::getSubByKey($detail, "avatarid");
             $attachmentidArr = ConvertUtil::getSubByKey($detail, "attachmentid");
             if (!empty($avataridArr)) {
                 foreach ($avataridArr as $avatarid) {
                     AttachUtil::delAttach($avatarid);
                 }
             }
             if (!empty($attachmentidArr)) {
                 foreach ($attachmentidArr as $attachmentid) {
                     AttachUtil::delAttach($attachmentid);
                 }
             }
             ResumeDetail::model()->deleteAll("FIND_IN_SET(resumeid,'{$resumeids}') ");
             $this->ajaxReturn(array("isSuccess" => 1, "msg" => Ibos::lang("Del succeed", "message")));
         } else {
             $this->ajaxReturn(array("isSuccess" => 0, "msg" => Ibos::lang("Del failed", "message")));
         }
     }
 }