コード例 #1
0
ファイル: module.php プロジェクト: saitinet/parsimony
 /**
  * Remove block
  * @param string $typeProgress
  * @param string $parentBlock
  * @param string $idBlock
  * @return string
  */
 protected function removeBlockAction($typeProgress, $parentBlock, $idBlock, $THEMEMODULE, $THEME)
 {
     $this->initObjects();
     $parent = $this->{$typeProgress}->searchBlock($parentBlock);
     $block = $this->{$typeProgress}->searchBlock($idBlock);
     if (is_object($block) && method_exists($block, 'destruct')) {
         $block->destruct();
     }
     $parent->rmBlock($idBlock);
     $test = $this->{$typeProgress}->searchBlock($idBlock);
     if ($test == NULL) {
         $path = PROFILE_PATH . $THEMEMODULE . '/themes/' . $THEME . '/style.css';
         if (is_file($path)) {
             $css = new \css($path);
             $css->deleteBlockSelectors('#' . $idBlock);
             $css->save();
         }
         $this->saveAll();
         $return = array('eval' => '$("#" + Parsimony.blocks["admin_blocks"].inProgress,ParsimonyAdmin.currentBody).remove();$("#changeres").trigger("change");', 'notification' => t('The block has been deleted'), 'notificationType' => 'positive');
     } else {
         $return = array('notification' => t('Container block cannot be deleted'), 'notificationType' => 'negative');
     }
     return $this->returnResult($return);
 }