Highway to PSR2
[openemr.git] / interface / super / rules / library / RuleCriteriaDiagnosis.php
blob57621b2a85ac83ad21c119b43fbe859a7a6bcac2
1 <?php
2 // Copyright (C) 2010-2011 Aron Racho <aron@mi-squred.com>
3 //
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (at your option) any later version.
9 /**
10 * Description of RuleCriteriaDiagnosis
12 * @author aron
14 class RuleCriteriaDiagnosis extends RuleCriteria
17 var $title;
18 var $codeType;
19 var $id;
21 function __construct($title, $codeType = '', $id = '')
23 $this->title = $title;
24 $this->codeType = $codeType;
25 $this->id = $id;
28 function getRequirements()
30 $codeManager = new CodeManager();
31 $code = $codeManager->get($this->id);
32 if (is_null($code)) {
33 return $this->codeType . ":" . $this->id;
36 return $code->display();
39 function getTitle()
41 return $this->title;
44 function getView()
46 return "diagnosis.php";
49 function getDbView()
51 $dbView = parent::getDbView();
53 $dbView->method = "lists";
54 $dbView->methodDetail = "medical_problem";
55 $dbView->value = $this->codeType . "::" . $this->id;
56 return $dbView;
59 function updateFromRequest()
61 parent::updateFromRequest();
62 $value = _post("fld_value");
63 $exploded = explode(" ", $value);
64 $diagInfo = explode(":", $exploded[0]);
65 $this->codeType = $diagInfo[0];
66 $this->id = $diagInfo[1];