/** * editContent * * Edit content. * * @param array $data */ public function editContent($data) { // Get the original content $content = $this->getContentRow($data['content_id']); // Get content type $contentTypes = new Default_Model_ContentTypes(); $contentType = $contentTypes->getTypeById($content['id_cty_cnt']); // Unset fields that are not going to be updated unset($content['id_cnt']); unset($content['id_cty_cnt']); unset($content['views_cnt']); unset($content['created_cnt']); $content['title_cnt'] = htmlspecialchars($data['content_header']); $content['lead_cnt'] = htmlspecialchars($data['content_textlead']); $content['language_cnt'] = $data['content_language']; $content['body_cnt'] = htmlspecialchars($data['content_text']); if (!isset($data['content_research'])) { $data['content_research'] = ""; } if (!isset($data['content_opportunity'])) { $data['content_opportunity'] = ""; } if (!isset($data['content_threat'])) { $data['content_threat'] = ""; } if (!isset($data['content_solution'])) { $data['content_solution'] = ""; } $content['research_question_cnt'] = htmlspecialchars($data['content_research']); $content['opportunity_cnt'] = htmlspecialchars($data['content_opportunity']); $content['threat_cnt'] = htmlspecialchars($data['content_threat']); $content['solution_cnt'] = htmlspecialchars($data['content_solution']); $content['references_cnt'] = htmlspecialchars($data['content_references']); $content['modified_cnt'] = new Zend_Db_Expr('NOW()'); if (isset($data['publish']) && $data['publish'] == 1) { $content['published_cnt'] = 1; } $where = $this->getAdapter()->quoteInto('`id_cnt` = ?', $data['content_id']); // MIK� VITTU T�SS� KUSEE? if (!$this->update($content, $where)) { $return = false; } else { $return = $data['content_id']; } // Check if user has given keywords if (!empty($data['content_keywords'])) { // Get existing keywords of the content $cntHasTag = new Default_Model_ContentHasTag(); $existingTags = $cntHasTag->checkExistingTags($data['content_id'], $data['content_keywords']); //$existingTags = $cntHasTag->getContentTags($data['content_id']); $modelTags = new Default_Model_Tags(); $modelTags->addTagsToContent($data['content_id'], $data['content_keywords'], $existingTags); /* $i = 0; // Go through all existing keywords // This belongs to contentHasTags model foreach($existingTags as $existingTag) { // If some of the existing keywords aren't found in sent keywords, // that keyword is deleted the from content and maybe even from the // database if(!in_array($existingTag['name_tag'], $data['content_keywords'])) { // Removing tag from content $cntHasTag->deleteTagFromContent($existingTag['id_tag'], $data['content_id']); // If other content(s) doesn't have this tag, the whole // tag is going to be removed from the database if(!$cntHasTag->checkIfOtherContentHasTag($existingTag['id_tag'], $data['content_id'])) { $modelTags->removeTag($existingTag['id_tag']); } // Remove tag from existingTags array unset($existingTags[$i]); } $i++; } */ /* // Go through all sent keywords // This belongs to Tags model foreach($data['content_keywords'] as $tag) { $tag = strip_tags($tag); $foundTag = false; foreach($existingTags as $existingTag) { if($tag == $existingTag['name_tag']) { $foundTag = true; } } // If tag is not found in existing tags if(!$foundTag) { // Check if given keyword does not exists in database if($modelTags->tagExists($tag)) { // Create new keyword $tag = $modelTags->createTag($tag); } else { // Get keyword $tag = $modelTags->getTag($tag); } // end else // Add keywords to content $cntHasTag->addTagToContent($tag->id_tag, $data['content_id']); } } // end foreach */ } // end if // Check if user has related companies if (!empty($data['content_related_companies'])) { // Get existing related companies of the content $cntHasRec = new Default_Model_ContentHasRelatedCompany(); $existingCompanies = $cntHasRec->checkExistingCompanies($data['content_id'], $data['content_related_companies']); //$existingRecs = $cntHasRec->getContentRelComps($data['content_id']); $modelRecs = new Default_Model_RelatedCompanies(); $modelRecs->addRelatedCompaniesToContent($data['content_id'], $data['content_related_companies'], $existingCompanies); /* $i = 0; // Go through all existing related companies // FIX: This belongs to ContentHasRelatedCompany model foreach($existingRecs as $existingRec) { // If some of the existing related companies aren't found in sent // related companies, that related company is deleted from the // content and maybe even from thedatabase // FIXED: Could have caused mismatches when adding, // since when related company is added strip_tags is used // but not when doing comparisons here. // This goes for campaigns as well. if(!in_array($existingRec['name_rec'], $data['content_related_companies'])) { // Removing rec from content $cntHasRec->deleteRelCompFromContent($existingRec['id_rec'], $data['content_id']); // If other content(s) doesn't have this related company, the whole // related company is going to be removed from the database if(!$cntHasRec->checkIfOtherContentHasRelComp($existingRec['id_rec'], $data['content_id'])) { $modelRecs->removeRelComp($existingRec['id_rec']); } // Remove related company from existingRecs array unset($existingRecs[$i]); } $i++; } */ /* // Go through all sent related companies // FIX: This belongs to RelatedCompany model foreach($data['content_related_companies'] as $rec) { //$rec = strip_tags($rec); $foundRec = false; foreach($existingRecs as $existingRec) { if($rec == $existingRec['name_rec']) { $foundRec = true; } } // If related company is not found in existing related companies if(!$foundRec) { // Check if given related company does not exists in database if($modelRecs ->relCompExists($rec)) { // Create new related company $rec = $modelRecs ->createRelComp($rec); } else { // Get related company $rec = $modelRecs ->getRelComp($rec); } // end else // Add related company to content $cntHasRec->addRelCompToContent($rec->id_rec, $data['content_id']); } } // end foreach */ } // end if /* if($_FILES['content_file_upload']['size'] != 0) { $files = new Default_Model_Files(); $files->newFile($content->id_cnt, $auth->getIdentity()->user_id); } */ // Check if user has given campaigns if (!empty($data['content_campaigns'])) { // Get existing campaigns of the content $cntHasCmp = new Default_Model_ContentHasCampaign(); $existingCampaigns = $cntHasCmp->checkExistingCampaigns($data['content_id'], $data['content_campaigns']); //$existingCmps = $cntHasCmp->getContentCampaigns($data['content_id']); $modelCmps = new Default_Model_Campaigns(); $modelCmps->addCampaignsToContent($data['content_id'], $data['content_campaigns'], $existingCampaigns); /* $i = 0; // Go through all existing campaigns // FIX: This belongs to ContentHasCampaign moodel foreach($existingCmps as $existingCmp) { // If some of the existing campaigns aren't found in sent campaigns, // that campaign is deleted the from content and maybe even from the // database if(!in_array($existingCmp['name_cmp'], $data['content_campaigns'])) { // Removing campaign from content $cntHasCmp->deleteCampaignFromContent($existingCmp['id_cmp'], $data['content_id']); // If other content(s) doesn't have this campaign, the whole // campaign is going to be removed from the database if(!$cntHasCmp->checkIfOtherContentHasCampaign($existingCmp['id_cmp'], $data['content_id'])) { $modelCmps->removeCampaign($existingCmp['id_cmp']); } // Remove campaign from existingCmps array unset($existingCmps[$i]); } $i++; } */ /* // Go through all sent campaigns // FIX: This belongs to Campaigns model foreach($data['content_campaigns'] as $cmp) { //$cmp = strip_tags($cmp); $foundCmp = false; foreach($existingCmps as $existingCmp) { if($cmp == $existingCmp['name_cmp']) { $foundCmp = true; } } // If campaign is not found in existing tags if(!$foundCmp) { // Check if given campaign does not exists in database if($modelCmps->campaignExists($cmp)) { // Create new campaign $cmp = $modelCmps->createCampaign($cmp); } else { // Get campaign $cmp = $modelCmps->getCampaign($cmp); } // end else // Add campaigns to content $cntHasCmp->addCampaignToContent($cmp->id_cmp, $data['content_id']); } } // end foreach */ } // end if /*// Update industry to content $contentHasIndustry = new Default_Model_ContentHasIndustries(); $current_industry = $contentHasIndustry->getIndustryIdOfContent($data['content_id']); if($current_industry != $data['content_industry_id']) { if(!$contentHasIndustry->updateIndustryToContent($data['content_industry_id'], $data['content_id'])) { $return = false; } }*/ if ($return) { $filesModel = new Default_Model_Files(); $filesModel->newFiles($data['content_id'], "content", $data['files']); if (isset($data['uploadedFiles'])) { $filesModel->deleteCertainFiles($data['content_id'], "content", $data['uploadedFiles']); } } if ($contentType == "idea") { // Update innovation type to content $contentHasInnovationType = new Default_Model_ContentHasInnovationTypes(); $current_innovation_type = $contentHasInnovationType->getInnovationTypeIdOfContent($data['content_id']); if ($current_innovation_type != $data['innovation_type']) { if (!$contentHasInnovationType->updateInnovationTypeToContent($data['innovation_type'], $data['content_id'])) { $return = false; } } } return $return; }
/** * editAction * * Edit content * */ public function editAction() { // Get authentication $auth = Zend_Auth::getInstance(); // If user has identity if ($auth->hasIdentity()) { // Get requests $params = $this->getRequest()->getParams(); // Get session data $previewSession = new Zend_Session_Namespace('contentpreview'); // If preview $backFromPreview = isset($previewSession->backFromPreview) ? $previewSession->backFromPreview : 0; $preview = isset($params['preview']) ? 1 : 0; if ($preview) { $previewSession->unsetAll(); $previewSession->previewData = $params; $backToUrl = $this->getRequest()->getRequestUri(); $previewSession->backToUrl = $backToUrl; $url = $this->_urlHelper->url(array('controller' => 'content', 'action' => 'preview', 'language' => $this->view->language), 'lang_default', true); $this->_redirect($url); } // Get content type $contentId = isset($params['content_id']) ? $params['content_id'] : 0; $userId = $auth->getIdentity()->user_id; $cntHasUsr = new Default_Model_ContentHasUser(); $userIsOwner = $cntHasUsr->contentHasOwner($userId, $contentId); if ($userIsOwner) { if ($contentId != 0) { $content = new Default_Model_Content(); $data = $content->getDataAsSimpleArray($contentId); // Creating array for form data $formData = array(); // Adding content type to form $formData['content_type'] = $data['id_cty_cnt']; // Adding content id to form $formData['content_id'] = $contentId; $formData['content_header'] = stripslashes($data['title_cnt']); $modelCntHasTag = new Default_Model_ContentHasTag(); $keywords = $modelCntHasTag->getContentTags($data['id_cnt']); $tags = ""; $tagCount = count($keywords); for ($i = 0; $i < $tagCount; $i++) { $tags .= $keywords[$i]['name_tag']; if ($i != $tagCount - 1) { $tags .= ', '; } } $formData['content_keywords'] = stripslashes($tags); $formData['content_textlead'] = stripslashes($data['lead_cnt']); $formData['content_text'] = stripslashes($data['body_cnt']); $modelCntHasRec = new Default_Model_ContentHasRelatedCompany(); $relComps = $modelCntHasRec->getContentRelComps($data['id_cnt']); $recs = ""; $recCount = count($relComps); for ($i = 0; $i < $recCount; $i++) { $recs .= $relComps[$i]['name_rec']; if ($i != $recCount - 1) { $recs .= ', '; } } $formData['content_related_companies'] = stripslashes($recs); $formData['content_research'] = $data['research_question_cnt']; $formData['content_opportunity'] = $data['opportunity_cnt']; $formData['content_threat'] = $data['threat_cnt']; $formData['content_solution'] = $data['solution_cnt']; $formData['published_cnt'] = $data['published_cnt']; $formData['content_references'] = $data['references_cnt']; $languages = new Default_Model_Languages(); $idLngInd = $languages->getLangIdByLangName($this->view->language); $allLanguages = $languages->getAllNamesAndIds(); $formData['languages'] = array(); $formData['languages'][0] = $this->view->translate("content-add-select-language"); foreach ($allLanguages as $lng) { $formData['languages'][$lng['id_lng']] = $lng['name_lng']; } $finfoClasses = new Default_Model_FutureinfoClasses(); $allClasses = $finfoClasses->getAllNamesAndIds(); $formData['FutureinfoClasses'] = array(); $formData['FutureinfoClasses'][0] = $this->view->translate("content-add-select-finfo-classification"); foreach ($allClasses as $class) { $formData['FutureinfoClasses'][$class['id_fic']] = $class['name_fic']; } // Getting innovation types from the database $modelInnovationTypes = new Default_Model_InnovationTypes(); $innovationTypes = $modelInnovationTypes->getAllNamesAndIds(); // Getting the innovation type of the content $modelCntHasIvt = new Default_Model_ContentHasInnovationTypes(); $formData['selected_ivt'] = $modelCntHasIvt->getInnovationTypeIdOfContent($data['id_cnt']); // Adding all innovation types to form $formData['InnovationTypes'] = array(); $formData['InnovationTypes'][0] = $this->view->translate("content-add-select-innovation"); foreach ($innovationTypes as $ivt) { $formData['InnovationTypes'][$ivt['id_ivt']] = $ivt['name_ivt']; } // end foreach if (empty($formData['InnovationTypes'])) { $formData['InnovationTypes'] = array(0 => '----'); } $languages = new Default_Model_Languages(); $idLngInd = $languages->getLangIdByLangName($this->view->language); // Getting language of the content $formData['content_language'] = $languages->getLangIdByLangName($data['language_cnt']); // Getting the industry of the content $modelCntHasInd = new Default_Model_ContentHasIndustries(); $cntInd = $modelCntHasInd->getIndustryIdOfContent($data['id_cnt']); // Getting industries from the database $modelIndustries = new Default_Model_Industries(); $industries = $modelIndustries->getNamesAndIdsById(0, $idLngInd); // Getting all industries of the content $industryIds = $modelIndustries->getAllContentIndustryIds($cntInd); $formData['industryIds'] = $industryIds; // Adding all industries of the content to form $formData['selected_industry'] = $industryIds[0]; $formData['selected_division'] = $industryIds[1]; $formData['selected_group'] = $industryIds[2]; $formData['selected_class'] = $industryIds[3]; // Adding all industries to form $formData['Industries'] = array(); $formData['Industries'][0] = $this->view->translate("content-add-select-industry"); foreach ($industries as $ind) { $formData['Industries'][$ind['id_ind']] = $ind['name_ind']; } // end foreach if (empty($formData['Industries'])) { $formData['Industries'] = array(0 => '----'); } // Adding all divisions to form $formData['Divisions'] = array(); $formData['Divisions'][0] = $this->view->translate("content-add-select-division-no-industry"); if ($industryIds[0] != 0) { $divisions = $modelIndustries->getNamesAndIdsById($industryIds[0], $idLngInd); foreach ($divisions as $div) { $formData['Divisions'][$div['id_ind']] = $div['name_ind']; } // end foreach } // Adding all groups to form $formData['Groups'] = array(); $formData['Groups'][0] = $this->view->translate("content-add-select-group-no-division"); if ($industryIds[1] != 0) { $groups = $modelIndustries->getNamesAndIdsById($industryIds[1], $idLngInd); foreach ($groups as $grp) { $formData['Groups'][$grp['id_ind']] = $grp['name_ind']; } // end foreach } $formData['Classes'] = array(); $formData['Classes'][0] = $this->view->translate("content-add-select-class-no-group"); // If there's no group selected if ($industryIds[2] != 0) { $classes = $modelIndustries->getNamesAndIdsById($industryIds[2], $idLngInd); foreach ($classes as $class) { $formData['Classes'][$class['id_ind']] = $class['name_ind']; } // end foreach } $modelContentTypes = new Default_Model_ContentTypes(); $contentType = $modelContentTypes->getTypeById($data['id_cty_cnt']); $this->view->short_contenttype = $contentType; $title_cnt = $content->getContentHeaderByContentId($data['id_cnt']); $this->view->contentHeader = $title_cnt; // Get contents filenames from database $filesModel = new Default_Model_Files(); $filenames = $filesModel->getFilenamesByCntId($contentId); $formData['filenames'] = $filenames; // Form for content adding $form = new Default_Form_EditContentForm(null, $formData, $contentId, $contentType, $this->view->language); $form->populate($formData); $this->view->form = $form; $url = $this->_urlHelper->url(array('controller' => 'msg', 'action' => 'index', 'language' => $this->view->language), 'lang_default', true); // populate form if ($backFromPreview) { // Get previewdata and populate it to form $previewData = $previewSession->previewData; $form->populate($previewData); // Delete session data $previewSession->unsetAll(); } // If posted if ($this->getRequest()->isPost()) { // Get content data $data = $this->getRequest()->getPost(); // Content id $data['content_id'] = $contentId; // If form data is valid, handle database insertions $validForm = $form->isValid($data) ? true : isset($data['content_save']) && $data['content_save'] != ''; if ($validForm) { // If form data is going to be published if (isset($data['content_publish']) && $data['content_publish'] == 1) { $data['publish'] = 1; $message_error = 'content-publish-not-successful'; } elseif (isset($data['content_save']) && $data['content_save'] == 1) { $data['publish'] = 0; $message_error = 'content-save-not-successful'; } // Content keywords /* FIXED: split() is deprecated in PHP 5.3.0 -> and removed in * PHP 6.0, so changed to explode(). Also trim(array) doesn't * trim array values, so this is done with foreach now. */ $keywords = array(); foreach (explode(',', $data['content_keywords']) as $keyword) { if (trim($keyword) != "") { $keywords[] = strip_tags(trim($keyword)); } } $data['content_keywords'] = array_unique($keywords); // Related companies $relatedCompanies = array(); foreach (explode(',', $data['content_related_companies']) as $relatedCompany) { if (trim($relatedCompany) != "") { $relatedCompanies[] = strip_tags(trim($relatedCompany)); } } $data['content_related_companies'] = array_unique($relatedCompanies); // Get user id $data['User']['id_usr'] = $auth->getIdentity()->user_id; /* if($data['content_division'] == 0) { $data['content_industry_id'] = $data['content_industry']; } elseif($data['content_group'] == 0) { $data['content_industry_id'] = $data['content_division']; } elseif($data['content_class'] == 0) { $data['content_industry_id'] = $data['content_group']; } elseif($data['content_class'] != 0) { $data['content_industry_id'] = $data['content_class']; }*/ if ($data['content_language'] == 0) { $data['content_language'] = $this->view->language; } else { $data['content_language'] = $languages->getLangNameByLangId($data['content_language']); } //echo "<pre>"; print_r($data); echo "</pre>"; die(); $data['files'] = $_FILES['content_file_upload']; // Edit content $content = new Default_Model_Content(); $oldData = $content->getContentRow($contentId); $edit = $content->editContent($data); $url = $this->_urlHelper->url(array('controller' => 'msg', 'action' => 'index', 'language' => $this->view->language), 'lang_default', true); if ($edit) { //$favourite = new Default_Model_UserHasFavourites(); //$favouriteEdited = $favourite->setFavouriteModifiedTrue($edit); if ($oldData['published_cnt'] == 1 || isset($data['content_publish']) && $data['content_publish'] == 1) { $url = $this->_urlHelper->url(array('content_id' => $edit, 'language' => $this->view->language), 'content_shortview', true); $this->_redirect($url); } else { /*$message_ok = $this->view->translate('content-save-successful'); $message_ok .= ' ('.$content->getContentHeaderByContentId($edit).')'; $message_ok .= '<br /><br />' . $this->view->translate('content-save-successful2'); $userpage = $this->_urlHelper->url(array('controller' => 'account', 'action' => 'view', 'user' => $auth->getIdentity()->username, 'language' => $this->view->language), 'lang_default', true); $message_ok .= ' <a href="'.$userpage.'">'.$this->view->translate('content-save-successful3').'</a>'; $message_ok .= ' ' . $this->view->translate('content-save-successful4'); $this->flash($message_ok, $url);*/ $url = $this->_urlHelper->url(array('controller' => 'account', 'action' => 'view', 'language' => $this->view->language, 'user' => $auth->getIdentity()->username), 'lang_default', true); $this->_redirect($url); } } else { $this->flash($message_error, $url); } } else { // What is this? //Zend_Debug::dump($form); die; } /* // Content keywords $keywords = split(', ', trim($data['content_keywords'])); $data['content_keywords'] = array_unique($keywords); if($data['content_group'] == 0) { $data['content_industry_id'] = $data['content_division']; } elseif($data['content_class'] == 0) { $data['content_industry_id'] = $data['content_group']; } elseif($data['content_class'] != 0) { $data['content_industry_id'] = $data['content_class']; } // Update the edited content to database $content = new Default_Model_Content(); if($content->editContent($data)) { $message = 'content-edit-successful'; } else { $message = 'content-edit-not-successful'; } $this->flash($message, $url);*/ } } else { $message = 'content-edit-no-id'; $this->flash($message, $url); } } else { $message = 'content-edit-not-owner'; $this->flash($message, $url); } } else { // If not logged, redirecting to system message page $message = 'content-edit-not-logged'; $this->flash($message, $url); } // end else }
/** * removeContent * Removes specified content from the database and all related stuff * * @param int id_cnt The id of content to be removed * @return boolean array $contentRemoveChecker * @author Mikko Korpinen */ public function removeContentAndDepending($id_cnt = 0) { $contentRemoveChecker = array('removeContentFromContent' => true, 'removeContentFromFutureinfoClasses' => true, 'removeContentFromIndustries' => true, 'removeContentFromInnovationTypes' => true, 'removeContentFromRelatedCompanies' => true, 'removeContentRelatedCompanies' => true, 'removeContentFromTags' => true, 'removeContentTags' => true, 'removeContentFromUser' => true, 'removeContentViews' => true, 'removeContentFlags' => true, 'removeContentCommentFlags' => true, 'removeContentRatings' => true, 'removeContentFiles' => true, 'removeUserFromFavorites' => true, 'removeContent' => true, 'removeContentComments' => true); // cnt_has_cnt $cntHasCnt = new Default_Model_ContentHasContent(); if (!$cntHasCnt->removeContentFromContents($id_cnt)) { $contentRemoveChecker['removeContentFromContent'] = false; } // cnt_has_fic $cntHasFic = new Default_Model_ContentHasFutureinfoClasses(); if (!$cntHasFic->removeFutureinfoClassesFromContent($id_cnt)) { $contentRemoveChecker['removeContentFromFutureinfoClasses'] = false; } // cnt_has_grp // Not used? // cnt_has_ind $cntHasInd = new Default_Model_ContentHasIndustries(); if (!$cntHasInd->removeIndustriesFromContent($id_cnt)) { $contentRemoveChecker['removeContentFromIndustries'] = false; } // cnt_has_ivt $cntHasIvt = new Default_Model_ContentHasInnovationTypes(); if (!$cntHasIvt->removeInnovationTypesFromContent($id_cnt)) { $contentRemoveChecker['removeContentFromInnovationTypes'] = false; } // related_companies_rec and cnt_has_rec $cntHasRec = new Default_Model_ContentHasRelatedCompany(); $recs = $cntHasRec->getContentRelComps($id_cnt); $rec = new Default_Model_RelatedCompanies(); foreach ($recs as $id_rec) { if (!$cntHasRec->checkIfOtherContentHasRelComp($id_rec['id_rec'], $id_cnt)) { if (!$rec->removeRelComp($id_rec['id_rec'])) { $contentRemoveChecker['removeRelatedCompanies'] = false; } } } if (!$cntHasRec->removeContentRelComps($id_cnt)) { $contentRemoveChecker['removeContentFromRelatedCompanies'] = false; } // tags_tag and cnt_has_tag $cntHasTag = new Default_Model_ContentHasTag(); $tags = $cntHasTag->getContentTags($id_cnt); $tag = new Default_Model_Tags(); foreach ($tags as $id_tag) { if (!$cntHasTag->checkIfOtherContentHasTag($id_tag['id_tag'], $id_cnt)) { if (!$tag->removeTag($id_tag['id_tag'])) { $contentRemoveChecker['removeTags'] = false; } } } if (!$cntHasTag->removeContentTags($id_cnt)) { $contentRemoveChecker['removeContentFromTags'] = false; } // cnt_has_usr $cntHasUsr = new Default_Model_ContentHasUser(); if (!$cntHasUsr->removeUserFromContent($id_cnt)) { $contentRemoveChecker['removeContentFromUser'] = false; } // cnt_publish_times_pbt // Not used? // cnt_views_vws $cntWiewsVws = new Default_Model_ContentViews(); if (!$cntWiewsVws->removeContentViews($id_cnt)) { $contentRemoveChecker['removeContentViews'] = false; } // Flags from content_flags_cfl $contentflagmodel = new Default_Model_ContentFlags(); $cnfl_ids = $contentflagmodel->getFlagsByContentId($id_cnt); if (is_array($cnfl_ids)) { foreach ($cnfl_ids as $cfl_id) { if (!$contentflagmodel->removeFlag($cfl_id)) { $contentRemoveChecker['removeContentFlags'] = false; } } } // Flags from comment_flags_cfl $commentflagmodel = new Default_Model_CommentFlags(); $cmfl_ids = $commentflagmodel->getFlagsByContentId($id_cnt); if (is_array($cmfl_ids)) { foreach ($cmfl_ids as $cfl_id) { if (!$commentflagmodel->removeFlag($cfl_id)) { $contentRemoveChecker['removeContentCommentFlags'] = false; } } } // content_ratings_crt $contentRatingRct = new Default_Model_ContentRatings(); if (!$contentRatingRct->removeContentRatings($id_cnt)) { $contentRemoveChecker['removeContentRatings'] = false; } // files_fil $files = new Default_Model_Files(); if (!$files->removeContentFiles($id_cnt)) { $contentRemoveChecker['removeContentFiles'] = false; } // links_lnk // Not used? // usr_has_fvr $usrHasFvr = new Default_Model_UserHasFavourites(); if (!$usrHasFvr->removeAllContentFromFavouritesByContentId($id_cnt)) { $contentRemoveChecker['removeUserFromFavorites'] = false; } // contents_cnt $contentmodel = new Default_Model_Content(); if (!$contentmodel->removeContent($id_cnt)) { $contentRemoveChecker['removeContent'] = false; } // coments_cmt $commentmodel = new Default_Model_Comments(); if (!$commentmodel->removeAllContentComments($id_cnt)) { $contentRemoveChecker['removeContentComments'] = false; } return $contentRemoveChecker; }