OnContextBoxDelete() public static method

Remove the given context box articles.
public static OnContextBoxDelete ( integer $contextBoxId ) : void
$contextBoxId integer
return void
Example #1
0
 /**
  * Remove the context box for the given article.
  * @param int $articleNumber
  * @return void
  */
 public static function OnArticleDelete($articleNumber)
 {
     global $g_ado_db;
     $articleNumber = (int) $articleNumber;
     if ($articleNumber < 1) {
         return;
     }
     $queryStr = 'SELECT * FROM context_boxes' . " WHERE fk_article_no = '{$articleNumber}'";
     $boxes = $g_ado_db->GetAll($queryStr);
     foreach ($boxes as $box) {
         ContextBoxArticle::OnContextBoxDelete($box['id']);
     }
     $queryStr = 'DELETE FROM context_boxes' . " WHERE fk_article_no = '{$articleNumber}'";
     $g_ado_db->Execute($queryStr);
 }