woops forgot to add those in last update, also loading all categories from the db works now
--HG-- branch : quitta-gsoc-2013
This commit is contained in:
parent
a3b284077c
commit
a81b2dc9b3
3 changed files with 90 additions and 1 deletions
|
@ -25,9 +25,24 @@ class Ticket_Category{
|
||||||
$instance = new self($db_data);
|
$instance = new self($db_data);
|
||||||
$instance->setTCategoryId($id);
|
$instance->setTCategoryId($id);
|
||||||
return $instance;
|
return $instance;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//returns list of all category objects
|
||||||
|
public static function getAllCategories($db_data) {
|
||||||
|
$dbl = new DBLayer($db_data);
|
||||||
|
$statement = $dbl->executeWithoutParams("SELECT * FROM ticket_category");
|
||||||
|
$row = $statement->fetchAll();
|
||||||
|
$result = Array();
|
||||||
|
foreach($row as $category){
|
||||||
|
$instance = new self($db_data);
|
||||||
|
$instance->tCategoryId = $category['TCategoryId'];
|
||||||
|
$instance->name = $category['Name'];
|
||||||
|
$result[] = $instance;
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//return constructed element based on TCategoryId
|
//return constructed element based on TCategoryId
|
||||||
public function load_With_TCategoryId( $id) {
|
public function load_With_TCategoryId( $id) {
|
||||||
$dbl = new DBLayer($this->db);
|
$dbl = new DBLayer($this->db);
|
||||||
|
@ -37,6 +52,7 @@ class Ticket_Category{
|
||||||
$this->name = $row['Name'];
|
$this->name = $row['Name'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//update private data to DB.
|
//update private data to DB.
|
||||||
public function update(){
|
public function update(){
|
||||||
$dbl = new DBLayer($this->db);
|
$dbl = new DBLayer($this->db);
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
function createticket(){
|
||||||
|
|
||||||
|
//create array of category id & names
|
||||||
|
global $cfg;
|
||||||
|
$catArray = Ticket_Category::getAllCategories($cfg['db']['lib']);
|
||||||
|
$result['category'] = Array();
|
||||||
|
foreach($catArray as $catObj){
|
||||||
|
$result['category'][$catObj->getTCategoryId()] = $catObj->getName();
|
||||||
|
}
|
||||||
|
//print_r($result);
|
||||||
|
return $result;
|
||||||
|
}
|
|
@ -0,0 +1,59 @@
|
||||||
|
{block name=content}
|
||||||
|
<div class="row-fluid sortable ui-sortable">
|
||||||
|
<div class="box span8">
|
||||||
|
<div class="box-header well" data-original-title="">
|
||||||
|
<h2><i class="icon-th"></i> Create a new Ticket</h2>
|
||||||
|
<div class="box-icon">
|
||||||
|
<a href="#" class="btn btn-minimize btn-round"><i class="icon-chevron-up"></i></a>
|
||||||
|
<a href="#" class="btn btn-close btn-round"><i class="icon-remove"></i></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="box-content">
|
||||||
|
<div class="row-fluid">
|
||||||
|
<form id="changePassword" class="form-vertical" method="post" action="index.php?page=settings&id={$target_id}">
|
||||||
|
<legend>New ticket</legend>
|
||||||
|
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label">Title</label>
|
||||||
|
<div class="controls">
|
||||||
|
<div class="input-prepend">
|
||||||
|
<input type="text" class="span8" id="Title" name="Title">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label">Category</label>
|
||||||
|
<div class="controls">
|
||||||
|
<select name="Category">
|
||||||
|
{foreach from=$category key=k item=v}
|
||||||
|
<option value="{$k}">{$v}</option>
|
||||||
|
{/foreach}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label">Description</label>
|
||||||
|
<div class="controls">
|
||||||
|
<div class="input-prepend">
|
||||||
|
<textarea rows="12" class="span12" id="Content" name="Content"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<input type="hidden" name="function" value="change_info">
|
||||||
|
<input type="hidden" name="target_id" value="{$target_id}">
|
||||||
|
<div class="control-group">
|
||||||
|
<label class="control-label"></label>
|
||||||
|
<div class="controls">
|
||||||
|
<button type="submit" class="btn btn-primary" style="margin-left:5px; margin-top:10px;">Send Ticket</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div><!--/span-->
|
||||||
|
</div><!--/row-->
|
||||||
|
{/block}
|
||||||
|
|
Loading…
Reference in a new issue