isExist() and ! $this->disabled; } public function delete ($id = NULL) { if ($this->isExist ()) { $table_prefix = $this->getTablePrefix (); $this->query ("DELETE FROM `{$table_prefix}templatekeywords_templates` WHERE `template_id` = ?", $this->id); $this->query ("DELETE FROM `{$table_prefix}templatecategories_templates` WHERE `template_id` = ? AND templatecategory_id < ?", $this->id, TemplateCategory_Model::CUSTOM_CATEGORY); $this->query ("DELETE FROM `{$table_prefix}templates_templatesoftwares` WHERE `template_id` = ?", $this->id); $this->query ("DELETE FROM `{$table_prefix}templates_templatesources` WHERE `template_id` = ?", $this->id); $this->query ("DELETE FROM `{$table_prefix}templates_templatestyles` WHERE `template_id` = ?", $this->id); $query = <<query ($query, $this->id); $query = <<query ($query, $this->id); parent::delete (); } } public function getSmallPreview () { return $this->small_preview->uri; } function getMainPreview () { return $this->large_preview->uri; } function getSubsections () { $result = array (); foreach ($this->templatesubsections as $section) { $result [$section->position] = $section->subsection; } ksort ($result); return $result; } function getKeywords () { $result = array (); foreach ($this->templatekeywords as $keyword) { $result[] = $keyword->name; } return $result; } function getRemoteScreenshotUrl ($scrname) { return self::SCREENSHOT_DISTRIBUTION . $scrname; } }