Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class DecidedCase extends DataObject {
- static $db = array(
- 'Type' => "Enum('Appeal,Complaint,Consent Order,High Court Judgement,Intermediate Merger,Interim Relief,Large Merger,Procedure')",
- 'Status' => "Enum('Undecided,Approved,Approved with Conditions,Declined')",
- 'Title' => 'Varchar',
- 'Number' => 'Varchar(64)',
- 'Applicant' => 'Text',
- 'Respondent' => 'Text',
- 'Rating' => 'Int(2)',
- 'Date' => 'Date',
- 'Time' => 'Time',
- 'Summary' => 'HTMLText',
- 'Keywords' => 'Text',
- 'Source' => 'Varchar'
- );
- static $defaults = array(
- "Status" => 'Undecided',
- );
- static $has_one = array(
- 'Document' => 'File',
- 'CaseHolder' => 'DecidedCaseHolder'
- );
- static $searchable_fields = array(
- 'Number' => 'PartialMatchFilter',
- 'Date' => 'ExactMatchFilter',
- 'Title' => 'PartialMatchFilter',
- 'Type' => 'ExactMatchFilter',
- 'Status' => 'ExactMatchFilter',
- 'Applicant' => 'PartialMatchFilter',
- 'Respondent' => 'PartialMatchFilter',
- 'Summary' => 'PartialMatchFilter',
- 'Keywords' => 'PartialMatchFilter'
- );
- static $summary_fields = array(
- 'Number',
- 'Date',
- 'Title',
- 'Applicant',
- 'Respondent',
- 'Type',
- 'Status',
- );
- public static $default_sort = "Date DESC";
- static $extensions = array(
- 'SphinxSearchable'
- );
- static $sphinx = array(
- "mode" => "xmlpipe",
- "external_content" => array("file_content" => array("DecidedCase", "getDocumentContent"))
- );
- function getDocumentContent($caseID) {
- $case = DataObject::get_by_id("DecidedCase", $caseID);
- if (!$case || !$case->Document()) return "";
- return $case->Document()->extractFileAsText();
- }
- function Link(){
- $Holder = $this->CaseHolder();
- $Link = $Holder->Link() . 'cases/' . $Type=strtolower(str_replace( " ", "-", $this->Type)) . '/retrieve_case/' . $this->ID;
- return $Link;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement