OnIssueDelete() public static method

This should be called whenever an issue is deleted.
public static OnIssueDelete ( $p_publicationId, integer $p_issueNumber, $p_languageId )
$p_issueNumber integer
Beispiel #1
0
 /**
  * Delete the Issue, and optionally all sections and articles contained within it.
  * @param boolean $p_deleteSections
  * @param boolean $p_deleteArticles
  * @return int
  * 		Return the number of articles deleted.
  */
 public function delete($p_deleteSections = true, $p_deleteArticles = true)
 {
     global $g_ado_db;
     // Delete all scheduled publishing events
     IssuePublish::OnIssueDelete($this->m_data['IdPublication'], $this->m_data['Number'], $this->m_data['IdLanguage']);
     $articlesDeleted = 0;
     if ($p_deleteSections) {
         $sections = Section::GetSections($this->m_data['IdPublication'], $this->m_data['Number'], $this->m_data['IdLanguage']);
         foreach ($sections as $section) {
             $articlesDeleted += $section->delete($p_deleteArticles);
         }
     }
     $tmpData = $this->m_data;
     $success = parent::delete();
     if ($success) {
         $outputSettingIssues = $this->getOutputSettingIssueService()->findByIssue($tmpData['id']);
         foreach ($outputSettingIssues as $outputSet) {
             $this->getOutputSettingIssueService()->delete($outputSet);
         }
     }
     return $articlesDeleted;
 }
Beispiel #2
0
	/**
	 * Delete the Issue, and optionally all sections and articles contained within it.
	 * @param boolean $p_deleteSections
	 * @param boolean $p_deleteArticles
	 * @return int
	 * 		Return the number of articles deleted.
	 */
	public function delete($p_deleteSections = true, $p_deleteArticles = true)
	{
	    global $g_ado_db;

	    // Delete all scheduled publishing events
	    IssuePublish::OnIssueDelete($this->m_data['IdPublication'], $this->m_data['Number'], $this->m_data['IdLanguage']);

	    $articlesDeleted = 0;
	    if ($p_deleteSections) {
	        $sections = Section::GetSections($this->m_data['IdPublication'], $this->m_data['Number'], $this->m_data['IdLanguage']);
    		foreach ($sections as $section) {
		    $articlesDeleted += $section->delete($p_deleteArticles);
    		}
	    }

	    $tmpData = $this->m_data;
	    $success = parent::delete();
	    if ($success) {
	        if (function_exists("camp_load_translation_strings")) {
		    camp_load_translation_strings("api");
		}
	    	$logtext = getGS('Issue "$1" ($2) from publication $3 deleted',
				 $tmpData['Name'], $tmpData['Number'],
				 $tmpData['IdPublication']);
		Log::Message($logtext, null, 12);
	    }
	    return $articlesDeleted;
	} // fn delete