Ejemplo n.º 1
0
 /**
  * @covers AppBundle\Entity\Court::setActive
  * @covers AppBundle\Entity\Court::getActive
  * Implement testActive().
  */
 public function testActive()
 {
     $this->court->setActive(TRUE);
     $this->assertTrue($this->court->getActive());
     $this->court->setActive(FALSE);
     $this->assertFalse($this->court->getActive());
 }
Ejemplo n.º 2
0
 /**
  * Resets all references to other model objects or collections of model objects.
  *
  * This method is a user-space workaround for PHP's inability to garbage collect
  * objects with circular references (even in PHP 5.3). This is currently necessary
  * when using Propel in certain daemon or large-volume/high-memory operations.
  *
  * @param boolean $deep Whether to also clear the references on all referrer objects.
  */
 public function clearAllReferences($deep = false)
 {
     if ($deep && !$this->alreadyInClearAllReferencesDeep) {
         $this->alreadyInClearAllReferencesDeep = true;
         if ($this->aPlayer instanceof Persistent) {
             $this->aPlayer->clearAllReferences($deep);
         }
         if ($this->aCourt instanceof Persistent) {
             $this->aCourt->clearAllReferences($deep);
         }
         $this->alreadyInClearAllReferencesDeep = false;
     }
     // if ($deep)
     $this->aPlayer = null;
     $this->aCourt = null;
 }
Ejemplo n.º 3
0
        $localoffices[$i0] = @$r['5.' . $i0 . ''];
    }
    $courtofappeal = @$r['6'];
    $schedule = array();
    for ($i0 = 0; isset($r['7.' . $i0]); $i0++) {
        $schedule[$i0] = array('id' => @$r['7.' . $i0 . '.0'], 'casenr' => @$r['7.' . $i0 . '.0']);
        $schedule[$i0]['defendant'] = array();
        for ($i1 = 0; isset($r['7.' . $i0 . '.1.' . $i1]); $i1++) {
            $schedule[$i0]['defendant'][$i1] = @$r['7.' . $i0 . '.1.' . $i1 . ''];
        }
        $schedule[$i0]['plaintiff'] = array();
        for ($i1 = 0; isset($r['7.' . $i0 . '.2.' . $i1]); $i1++) {
            $schedule[$i0]['plaintiff'][$i1] = @$r['7.' . $i0 . '.2.' . $i1 . ''];
        }
    }
    $Court = new Court($ID, $Sessions, $panels, $members, $cases, $mainoffice, $localoffices, $courtofappeal, $schedule);
    if ($Court->save() !== false) {
        die('ok:' . $_SERVER['PHP_SELF'] . '?Court=' . urlencode($Court->getId()));
    } else {
        die('');
    }
    exit;
    // do not show the interface
}
$buttons = "";
if (isset($_REQUEST['new'])) {
    $new = true;
} else {
    $new = false;
}
if (isset($_REQUEST['edit']) || $new) {
Ejemplo n.º 4
0
 /**
  * @param	Court $court The court object to add.
  */
 protected function doAddCourt($court)
 {
     $this->collCourts[] = $court;
     $court->setCorporation($this);
 }
Ejemplo n.º 5
0
?>
      

            <?php 
echo $form->textFieldControlGroup($model, 'police_station_id', array('span' => 5));
?>
            
            <div id="select_district" >
                <label>Select District</label>
                <?php 
//echo $form->dropDownList($model,'district_id',CHtml::listData(District::model()->findAllByAttributes(array('states_id'=>$model->state_id),array('order' => 'name ASC')), 'id', 'name'),array('empty'=>'---Select State first---','span'=>5));
?>
                <?php 
echo $form->dropDownList($model, 'state_id', CHtml::listData(States::model()->findAllByPk(array(19, 7, 32)), 'id', 'name'), array('ajax' => array('type' => 'POST', 'url' => CController::createUrl('placeOfPosting/courts'), 'update' => '#PlaceOfOffence_court_id', 'data' => array('state_id' => 'js:this.value')), 'empty' => 'Select District'), array('span' => 5));
?>
 
            </div>

            <?php 
echo $form->dropDownListControlGroup($model, 'court_id', CHtml::listData(Court::model()->findAll(array('order' => 'id ASC')), 'id', 'name'), array('span' => 5));
?>
        <div class="form-actions">
        <?php 
echo TbHtml::submitButton($model->isNewRecord ? 'Create' : 'Save', array('color' => TbHtml::BUTTON_COLOR_PRIMARY, 'size' => TbHtml::BUTTON_SIZE_LARGE));
?>
    </div>

    <?php 
$this->endWidget();
?>
</div><!-- form -->
Ejemplo n.º 6
0
        ?>
</td>
                <td><?php 
        echo $v->date_time_offence;
        ?>
</td>
                <td><?php 
        echo $v->licence_no;
        ?>
</td>
                <td><?php 
        echo $v->name_person;
        ?>
</td>
                <td><?php 
        $court = Court::model()->findByPk($v->placeOfOffence->court_id);
        echo $court->name;
        ?>
</td>
            </tr>  
         <?php 
    }
    ?>
       
            <tr>
                <td colspan='7'>
                    <center><textarea name="dispatch[message]" placeholder="Enter Dispatch Comments (optional)" style="width:600px;"></textarea>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" value="Dispatch" class="btn btn-success" ></center>
                </td>
            </tr>
            
       <?php 
Ejemplo n.º 7
0
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return Court the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Court::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Ejemplo n.º 8
0
    <?php 
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'user-form', 'enableAjaxValidation' => false));
?>

    <p class="help-block">Fields with <span class="required">*</span> are required.</p>

    <?php 
echo $form->errorSummary($model);
?>
            
                    

            <label>Court</label>
            <?php 
echo $form->dropDownListControlGroup($model, 'master_id', CHtml::listData(Court::model()->findAllByAttributes(array('state_id' => 32, 'district_id' => 535), array('order' => 'name ASC')), 'id', 'name'), array('empty' => '---Select Court---', 'span' => 5, 'label' => false));
?>
            
            <?php 
echo $form->textFieldControlGroup($model, 'name', array('span' => 5, 'maxlength' => 45));
?>

            <?php 
echo $form->textFieldControlGroup($model, 'email', array('span' => 5, 'maxlength' => 45));
?>
            
            <?php 
echo $form->textFieldControlGroup($model, 'mobile', array('span' => 5, 'maxlength' => 45));
?>

            <?php 
Ejemplo n.º 9
0
 /**
  * Exclude object from result
  *
  * @param   Court $court Object to remove from the list of results
  *
  * @return CourtQuery The current query, for fluid interface
  */
 public function prune($court = null)
 {
     if ($court) {
         $this->addUsingAlias(CourtPeer::ID, $court->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }
Ejemplo n.º 10
0
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param Court $obj A Court object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool($obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         CourtPeer::$instances[$key] = $obj;
     }
 }
Ejemplo n.º 11
0
    public static function get_day_timeunits($date, $user = null)
    {
        global $DB;
        $courts = Court::get_all();
        $sql = '
				SELECT
					*
				FROM timeunits
				WHERE
					date=:date
				ORDER BY `date`, `from`
			';
        $sth = $DB->prepare($sql);
        $sth->bindParam(':date', $date, PDO::PARAM_STR);
        $sth->execute();
        $timeunits = array();
        foreach ($sth->fetchAll() as $tmp) {
            $timeunit = new TimeUnit($tmp, false);
            $timeunit->user = $user;
            if (!is_array($timeunits[$timeunit->court_id])) {
                $timeunits[$timeunit->court_id] = array();
            }
            $timeunits[$timeunit->court_id][] = $timeunit;
        }
        $ret = array();
        $ret['date'] = $date;
        $ret['fields'] = array();
        $i = 0;
        foreach ($courts as $court) {
            $j = 0;
            $ret['fields'][$i] = array();
            $ret['fields'][$i]['id'] = $court->id;
            $ret['fields'][$i]['title'] = $court->name;
            $ret['fields'][$i]['subtitle'] = $court->subtitle;
            $ret['fields'][$i]['intervals'] = array();
            if (is_array($timeunits[$court->id])) {
                foreach ($timeunits[$court->id] as $timeunit) {
                    $ret['fields'][$i]['intervals'][$j] = $timeunit->get_array();
                    $j++;
                }
            }
            $i++;
        }
        return $ret;
    }
Ejemplo n.º 12
0
 public function actionCourts()
 {
     //print_r($_POST);exit;
     $data = Court::model()->findAllByAttributes(array("district_id" => array($_POST['district'])));
     foreach ($data as $value => $name) {
         echo CHtml::tag('option', array('value' => $value), CHtml::encode($name->name . " - " . $name->judge_code), true);
     }
 }
Ejemplo n.º 13
0
 /**
  * Filter the query by a related Court object
  *
  * @param   Court|PropelObjectCollection $court The related object(s) to use as filter
  * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return                 PlayerCourtQuery The current query, for fluid interface
  * @throws PropelException - if the provided filter is invalid.
  */
 public function filterByCourt($court, $comparison = null)
 {
     if ($court instanceof Court) {
         return $this->addUsingAlias(PlayerCourtPeer::COURT_ID, $court->getId(), $comparison);
     } elseif ($court instanceof PropelObjectCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(PlayerCourtPeer::COURT_ID, $court->toKeyValue('PrimaryKey', 'Id'), $comparison);
     } else {
         throw new PropelException('filterByCourt() only accepts arguments of type Court or PropelCollection');
     }
 }
Ejemplo n.º 14
0
 /**
  * Filter the query by a related Court object
  *
  * @param   Court|PropelObjectCollection $court  the related object to use as filter
  * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return                 CorporationQuery The current query, for fluid interface
  * @throws PropelException - if the provided filter is invalid.
  */
 public function filterByCourt($court, $comparison = null)
 {
     if ($court instanceof Court) {
         return $this->addUsingAlias(CorporationPeer::ID, $court->getCorporationId(), $comparison);
     } elseif ($court instanceof PropelObjectCollection) {
         return $this->useCourtQuery()->filterByPrimaryKeys($court->getPrimaryKeys())->endUse();
     } else {
         throw new PropelException('filterByCourt() only accepts arguments of type Court or PropelCollection');
     }
 }
<?php

require_once $base_path . 'classes/checkframework.php';
$did = $_GET['did'];
if ($did != "") {
    $court = Court::get_by_id($did);
}
if (count($_POST) > 0) {
    if ($did == "") {
        $court = new Court($_POST);
    } else {
        $court->set_data_for_change($_POST);
    }
    $errors = array();
    $valid = $court->is_valid();
    if ($valid === true) {
        $court->save();
    } else {
        $errors = $valid;
    }
    $smarty->assign('errors', $errors);
    $smarty->display('return.tpl');
} else {
    $smarty->assign('court', $court);
    $smarty->display('admin-courts-modify.tpl');
}
            $objPHPExcel->getActiveSheet()->getStyle("C" . $row . ":D" . $row)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
            $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
            $rnd = STRING::Random(10);
            $bfn = 'report_' . $date_created_fn . '.xlsx';
            $fn = 'reports/' . $bfn;
            $objWriter->save($fn);
            header('Content-disposition: filename="' . $bfn . '"');
            header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
            echo file_get_contents($fn);
        } else {
            header("Access-Control-Allow-Origin: *");
            header('Content-Type: application/json');
            echo json_encode($ret);
        }
    } else {
        header("Access-Control-Allow-Origin: *");
        header('Content-Type: application/json');
        echo json_encode($ret);
    }
} else {
    $courts = Court::get_all();
    $smarty->assign('courts', $courts);
    if ($_GET['did']) {
        $smarty->assign('default_user', $_GET['did']);
    }
    $from_date = date('Y-m-01');
    $to_date = date('Y-m-d');
    $smarty->assign('from_date', $from_date);
    $smarty->assign('to_date', $to_date);
    $smarty->display('admin-report.tpl');
}
Ejemplo n.º 17
0
function delCourt($id)
{
    $tobeDeleted = new Court($id);
    if ($tobeDeleted->isNew()) {
        return true;
    }
    // item never existed in the first place
    if ($tobeDeleted->del()) {
        return true;
    } else {
        return $tobeDeleted;
    }
}
Ejemplo n.º 18
0
 public function actionCourts()
 {
     //print_r($_POST);exit;
     if (!empty($_POST['state_id'])) {
         $data = Court::model()->findAllByAttributes(array("state_id" => array($_POST['state_id'])));
         //print_r($data);exit;
         foreach ($data as $value => $name) {
             echo CHtml::tag('option', array('value' => $name->id), CHtml::encode($name->name), true);
         }
     }
 }
Ejemplo n.º 19
0
 /**
  * @param	Court $court The court object to add.
  */
 protected function doAddCourt(Court $court)
 {
     // set the back reference to this object directly as using provided method either results
     // in endless loop or in multiple relations
     if (!$court->getPlayers()->contains($this)) {
         $playerCourt = new PlayerCourt();
         $playerCourt->setCourt($court);
         $this->addPlayerCourt($playerCourt);
         $foreignCollection = $court->getPlayers();
         $foreignCollection[] = $this;
     }
 }
<?php

require_once $base_path . 'classes/checkframework.php';
$did = $_GET['did'];
if ($did != "") {
    $timeunit = TimeUnit::get_by_id($did);
} else {
    $court = Court::get_by_id($_GET['court']);
    $timeunit = new TimeUnit(array('date' => $selected_date, 'from' => $_GET['from'], 'court' => $court, 'price' => $court->price, 'available' => 1));
}
if (count($_POST) > 0) {
    $timeunit->set_data_for_change($_POST);
    $errors = array();
    $valid = $timeunit->is_valid();
    if ($valid === true) {
        $timeunit->save();
    } else {
        $errors = $valid;
    }
    $smarty->assign('errors', $errors);
    $smarty->display('return.tpl');
} else {
    $smarty->assign('timeunit', $timeunit);
    $smarty->display('admin-timeline-modify.tpl');
}