1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <?php
- namespace app\models;
- use Yii;
- use yii\base\Model;
- use yii\web\Response;
- use app\models\entity\Projecttypes;
- /**
- * ContactForm is the model behind the contact form.
- */
- class ProjectTypesModel extends Model
- {
-
- public function GrabTasktypes($chooseSubtasks = "all", $action = 0)
- {
- global $link, $companyID;
- //$str = "select * from tasktypes where company=$companyID";
- $str = "select p_r.id,p_r.name,p_r.input_keyword,p_r.company,p_r.tasktypes
- from project_types p_r
- join projectstypes_tasktypes p_t on p_t.project_types_id = p_r.id
- join tasktypes t on t.id = p_t.tasktypes_id
- where p_r.company = $companyID" ;
- if ($chooseSubtasks == "subs")
- $str .= " and main_task = 0";
- else if ($chooseSubtasks == "tasks")
- $str .= " and main_task = 1";
- if ($action > 0) {
- $ttstring = GrabTasktypesStringFromAction($action);
- //$str .= " and id in ($ttstring)";
- $str .= " and p_r.id = $action";
- }
- $str .= ' ORDER BY id desc';
- // echo "grab str ".$str." <br>action ".$action;
- // echo "grab TT11 ";
- $query1 = mysqli_query($link, $str);
- $subtaskarr = array();
- while ($res1 = mysqli_fetch_array($query1)) {
- //echo "grab TT ".$res1['id']." tt.id ".$res1['tt.id'];
- // print_r($res1);
- // echo "<br><br>";
- $tasktype_id = $res1['id'];
- $subtaskarr[$tasktype_id] = $res1;
- }
- return $subtaskarr;
- }
-
-
- }
|