Exemple #1
0
 public function actionDel()
 {
     if (Ibos::app()->request->isAjaxRequest) {
         $typeid = intval(EnvUtil::getRequest("typeid"));
         if (empty($typeid)) {
             $this->ajaxReturn(array("isSuccess" => false, "msg" => Ibos::lang("Parameters error", "error")));
         }
         $removeSuccess = ReportType::model()->remove($typeid);
         if ($removeSuccess) {
             $reports = Report::model()->fetchRepidAndAidByTypeids($typeid);
             if (!empty($reports)) {
                 if ($reports["aids"]) {
                     AttachUtil::delAttach($reports["aids"]);
                 }
                 ReportRecord::model()->deleteAll("repid IN('{$reports["repids"]}')");
                 Report::model()->deleteAll("repid IN('{$reports["repids"]}')");
             }
             $return["isSuccess"] = true;
             $return["msg"] = Ibos::lang("Del succeed", "message");
         } else {
             $return["isSuccess"] = false;
             $return["msg"] = Ibos::lang("Del failed", "message");
         }
         $this->ajaxReturn($return);
     }
 }
Exemple #2
0
 public function delBody($bodyIds, $archiveId = 0)
 {
     $table = sprintf("{{%s}}", $this->getTableName($archiveId));
     $bodys = Yii::app()->db->createCommand()->select("attachmentid")->from($table)->where("FIND_IN_SET(bodyid,'{$bodyIds}')")->queryAll();
     $attachIds = ConvertUtil::getSubByKey($bodys, "attachmentid");
     $attachId = StringUtil::filterStr(implode(",", $attachIds));
     if (!empty($attachId)) {
         AttachUtil::delAttach($attachId);
     }
     return Yii::app()->db->createCommand()->delete($table, "FIND_IN_SET(bodyid,'{$bodyIds}')");
 }
Exemple #3
0
 public function actionDelAttach()
 {
     $runId = intval(EnvUtil::getRequest("runid"));
     $attachId = intval(EnvUtil::getRequest("aid"));
     $run = FlowRun::model()->fetchByPk($runId);
     if ($run) {
         $aids = explode(",", $run["attachmentid"]);
         foreach ($aids as $i => $aid) {
             if ($aid == $attachId) {
                 unset($aids[$i]);
                 break;
             }
         }
         FlowRun::model()->modify($runId, array("attachmentid" => implode(",", $aids)));
         AttachUtil::delAttach($attachId);
         $this->ajaxReturn(array("isSuccess" => true));
     }
     $this->ajaxReturn(array("isSuccess" => false));
 }
Exemple #4
0
 public function actionDel()
 {
     if (Ibos::app()->request->isAjaxRequest) {
         $repids = EnvUtil::getRequest("repids");
         $uid = Ibos::app()->user->uid;
         if (empty($repids)) {
             $this->error(Ibos::lang("Parameters error", "error"), $this->createUrl("default/index"));
         }
         $pk = "";
         if (strpos($repids, ",")) {
             $repids = trim($repids, ",");
             $pk = explode(",", $repids);
         } else {
             $pk = array($repids);
         }
         $reports = Report::model()->fetchAllByPk($pk);
         foreach ($reports as $report) {
             if ($report["uid"] != $uid) {
                 $this->ajaxReturn(array("isSuccess" => false, "msg" => Ibos::lang("You do not have permission to delete the report")));
             }
         }
         $aids = Report::model()->fetchAllAidByRepids($pk);
         if ($aids) {
             AttachUtil::delAttach($aids);
         }
         $isInstallCalendar = ModuleUtil::getIsEnabled("calendar");
         if ($isInstallCalendar) {
             Calendars::model()->deleteALL("`calendarid` IN(select `cid` from {{calendar_rep_record}} where FIND_IN_SET(`repid`, '{$repids}')) ");
             CalendarRepRecord::model()->deleteAll("repid IN ({$repids})");
         }
         $delSuccess = Report::model()->deleteByPk($pk);
         if ($delSuccess) {
             ReportRecord::model()->deleteAll("repid IN('{$repids}')");
             ReportStats::model()->deleteAll("repid IN ({$repids})");
             $this->ajaxReturn(array("isSuccess" => true, "msg" => Ibos::lang("Del succeed", "message")));
         } else {
             $this->ajaxReturn(array("isSuccess" => false, "msg" => Ibos::lang("Del failed", "message")));
         }
     }
 }
Exemple #5
0
 public function completelyDelete($emailIds, $uid, $archiveId = 0)
 {
     $isSuccess = 0;
     $emailIds = is_array($emailIds) ? $emailIds : array($emailIds);
     $mainTable = sprintf("{{%s}}", $this->getTableName($archiveId));
     $bodyTable = sprintf("{{%s}}", EmailBody::model()->getTableName($archiveId));
     $bodyIds = Ibos::app()->db->createCommand()->select("bodyid")->from($mainTable)->where("FIND_IN_SET(emailid,'" . implode(",", $emailIds) . "')")->queryAll();
     if ($bodyIds) {
         $bodyIds = ConvertUtil::getSubByKey($bodyIds, "bodyid");
     }
     foreach ($bodyIds as $i => $bodyId) {
         $body = Ibos::app()->db->createCommand()->select("fromid,attachmentid")->from($bodyTable)->where("bodyid = {$bodyId} AND fromid = {$uid}")->queryRow();
         if ($body || !isset($emailIds[$i])) {
             if (isset($emailIds[$i])) {
                 $readerRows = Ibos::app()->db->createCommand()->select("bodyid")->from($mainTable)->where("emailid = {$emailIds[$i]} AND isread != 0 AND toid != {$uid}")->queryRow();
             } else {
                 $readerRows = false;
             }
             if ($readerRows) {
                 if (Ibos::app()->db->createCommand()->update($bodyTable, array("issenderdel" => 1), "bodyid = " . $bodyId)) {
                     $isSuccess = 1;
                 }
             } else {
                 if (isset($emailIds[$i])) {
                     $nextStep = Ibos::app()->db->createCommand()->delete($mainTable, "emailid = " . $emailIds[$i]);
                 } else {
                     Ibos::app()->db->createCommand()->delete($bodyTable, "bodyid = " . $bodyId);
                     $nextStep = true;
                 }
                 if ($nextStep) {
                     if ($body["attachmentid"] !== "") {
                         AttachUtil::delAttach($body["attachmentid"]);
                     }
                     $isSuccess = 1;
                 }
             }
         } else {
             $lastRows = Ibos::app()->db->createCommand()->select("toid")->from($mainTable)->where("bodyid = {$bodyId} AND toid != {$uid}")->queryRow();
             if (!$lastRows) {
                 Ibos::app()->db->createCommand()->delete($mainTable, "emailid = " . $emailIds[$i]);
                 $attachmentId = Ibos::app()->db->createCommand()->select("attachmentid")->from($bodyTable)->where("bodyid = " . $bodyId)->queryScalar();
                 if ($attachmentId && $attachmentId !== "") {
                     AttachUtil::delAttach($attachmentId);
                 }
                 $isSuccess++;
             } else {
                 Ibos::app()->db->createCommand()->delete($mainTable, "emailid = {$emailIds[$i]} AND toid = {$uid}");
                 $isSuccess++;
             }
         }
     }
     return $isSuccess;
 }
Exemple #6
0
 protected function handleImgComponent(&$formData)
 {
     foreach ($GLOBALS["_FILES"] as $key => $value) {
         if (strtolower(substr($key, 0, 5)) == "data_") {
             $formData["{$key}"] = "";
             $old = $_POST["imgid_" . substr($key, 5)];
             if ($value["name"] != "") {
                 if (!empty($old)) {
                     AttachUtil::delAttach($old);
                 }
                 $upload = FileUtil::getUpload($_FILES[$key], "workflow");
                 $upload->save();
                 $attach = $upload->getAttach();
                 $attachment = "workflow/" . $attach["attachment"];
                 $imgData = array("dateline" => TIMESTAMP, "filename" => $attach["name"], "filesize" => $attach["size"], "isimage" => $attach["isimage"], "attachment" => $attachment, "uid" => $this->uid);
                 $aid = Attachment::model()->add(array("uid" => $this->uid, "rid" => $this->runid, "tableid" => AttachUtil::getTableId($this->runid)), true);
                 $imgData["aid"] = $aid;
                 $newAttach = AttachmentN::model()->add(sprintf("rid:%d", $this->runid), $imgData, true);
                 $formData["{$key}"] = $newAttach;
             } else {
                 $formData["{$key}"] = $old;
             }
         }
     }
 }
Exemple #7
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")));
         }
     }
 }
Exemple #8
0
 public function actionDel()
 {
     if (Ibos::app()->request->isAjaxRequest) {
         $articleids = trim(EnvUtil::getRequest("articleids"), ",");
         $attachmentids = "";
         $attachmentIdArr = Article::model()->fetchAllFieldValueByArticleids("attachmentid", $articleids);
         foreach ($attachmentIdArr as $attachmentid) {
             if (!empty($attachmentid)) {
                 $attachmentids .= $attachmentid . ",";
             }
         }
         $count = 0;
         if (!empty($attachmentids)) {
             $splitArray = explode(",", trim($attachmentids, ","));
             $attachmentidArray = array_unique($splitArray);
             $attachmentids = implode(",", $attachmentidArray);
             $count = AttachUtil::delAttach($attachmentids);
         }
         if ($this->getVoteInstalled()) {
             Vote::model()->deleteAllByRelationIdsAndModule($articleids, "article");
         }
         ArticlePicture::model()->deleteAllByArticleIds($articleids);
         Article::model()->deleteAllByArticleIds($articleids);
         ArticleApproval::model()->deleteByArtIds($articleids);
         $this->ajaxReturn(array("isSuccess" => true, "count" => $count, "msg" => Ibos::lang("Del succeed", "message")));
     }
 }
Exemple #9
0
 public function actionDel()
 {
     if (Ibos::app()->request->isAjaxRequest) {
         $diaryids = EnvUtil::getRequest("diaryids");
         $uid = Ibos::app()->user->uid;
         if (empty($diaryids)) {
             $this->ajaxReturn(array("isSuccess" => false, "msg" => Ibos::lang("Select at least one")));
         }
         $pk = "";
         if (strpos($diaryids, ",")) {
             $diaryids = trim($diaryids, ",");
             $pk = explode(",", $diaryids);
         } else {
             $pk = array($diaryids);
         }
         $diarys = Diary::model()->fetchAllByPk($pk);
         foreach ($diarys as $diary) {
             if (!ICDiary::checkReadScope($uid, $diary)) {
                 $this->ajaxReturn(array("isSuccess" => false, "msg" => Ibos::lang("You do not have permission to delete the log")));
             }
         }
         $aids = Diary::model()->fetchAllAidByPks($pk);
         if ($aids) {
             AttachUtil::delAttach($aids);
         }
         $isInstallCalendar = ModuleUtil::getIsEnabled("calendar");
         if ($isInstallCalendar) {
             Calendars::model()->deleteALL("`calendarid` IN(select `cid` from {{calendar_record}} where FIND_IN_SET(`did`, '{$diaryids}')) ");
             CalendarRecord::model()->deleteAll("did IN ({$diaryids})");
         }
         Diary::model()->deleteByPk($pk);
         DiaryRecord::model()->deleteAll("diaryid IN ({$diaryids})");
         DiaryStats::model()->deleteAll("diaryid IN ({$diaryids})");
         $this->ajaxReturn(array("isSuccess" => true, "msg" => Ibos::lang("Del succeed", "message")));
     }
 }
 public function actionDel()
 {
     if (Ibos::app()->request->isAjaxRequest) {
         $docids = trim(EnvUtil::getRequest("docids"), ",");
         $attachmentIdArr = Officialdoc::model()->fetchAidsByDocids($docids);
         AttachUtil::delAttach($attachmentIdArr);
         if (!empty($docids)) {
             Officialdoc::model()->deleteAllByDocIds($docids);
             OfficialdocVersion::model()->deleteAllByDocids($docids);
             OfficialdocReader::model()->deleteReaderByDocIds($docids);
             OfficialdocApproval::model()->deleteByDocIds($docids);
             OfficialdocBack::model()->deleteByDocIds($docids);
             $this->ajaxReturn(array("isSuccess" => true, "info" => Ibos::lang("Del succeed", "message")));
         } else {
             $this->ajaxReturn(array("isSuccess" => false, "info" => Ibos::lang("Parameters error", "error")));
         }
     }
 }
Exemple #11
0
 private function _deleteFeedAttach($feedIds)
 {
     $feeddata = $this->getFeeds($feedIds);
     $feedDataInfo = ConvertUtil::getSubByKey($feeddata, "feeddata");
     $attachIds = array();
     foreach ($feedDataInfo as $value) {
         $value = unserialize($value);
         !empty($value["attach_id"]) && ($attachIds = array_merge($attachIds, $value["attach_id"]));
     }
     array_filter($attachIds);
     array_unique($attachIds);
     !empty($attachIds) && AttachUtil::delAttach($attachIds);
 }
Exemple #12
0
 public function actionDel()
 {
     if (Ibos::app()->request->isAjaxRequest) {
         $assignmentId = intval(EnvUtil::getRequest("id"));
         $checkRes = $this->checkAvailableById($assignmentId);
         if (!$checkRes["isSuccess"]) {
             $this->ajaxReturn($checkRes);
         }
         $assignment = Assignment::model()->fetchByPk($assignmentId);
         $uid = Ibos::app()->user->uid;
         if ($uid != $assignment["designeeuid"]) {
             $this->ajaxReturn(array("isSuccess" => false, "msg" => Ibos::lang("You donot have permission to delete")));
         }
         if (!empty($assignment["attachmentid"])) {
             AttachUtil::delAttach($assignment["attachmentid"]);
         }
         if ($this->getIsInstallCalendar() && !empty($assignment["remindtime"])) {
             Calendars::model()->deleteALL("`calendarid` IN(select `calendarid` from {{assignment_remind}} where assignmentid = {$assignmentId}) ");
             AssignmentRemind::model()->deleteAll("assignmentid = {$assignmentId}");
         }
         AssignmentLog::model()->addLog($assignmentId, "del", Ibos::lang("Delete the assignment"));
         Assignment::model()->deleteByPk($assignmentId);
         AssignmentApply::model()->deleteAll("assignmentid = {$assignmentId}");
         $this->ajaxReturn(array("isSuccess" => true, "msg" => Ibos::lang("Del succeed", "message")));
     }
 }