コード例 #1
0
 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         Equipment::create([]);
     }
 }
コード例 #2
0
 public function __construct()
 {
     $this->equipment = Equipment::getAll();
     $this->categories = array();
     $cats = EquipmentCategory::getAll();
     foreach ($cats as $cat) {
         $cats_data = array();
         $cats_data['name'] = $cat->getName();
         $cats_data['items'] = $cat->countEquipment();
         $cats_data['tickets'] = $cat->countOpenTickets();
         $this->categories[] = $cats_data;
     }
     $this->status = array();
     $stats = EquipmentStatus::getAll();
     foreach ($stats as $stat) {
         $stat_data = array();
         $stat_data['name'] = $stat->getName();
         $stat_data['items'] = $stat->countEquipment();
         $this->status[] = $stat_data;
     }
     $this->tickets = 0;
     foreach ($this->categories as $cat) {
         $ticket_count = $cat['tickets'];
         if (isset($ticket_count)) {
             $this->tickets += $ticket_count;
         }
     }
 }
コード例 #3
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 Equipment the loaded model
  * @throws CHttpException
  */
 public function loadEquipment($id)
 {
     $model = Equipment::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
コード例 #4
0
 /**
  * Display the specified event.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     if (!Sentry::getUser()) {
         return Redirect::route('sessions.create');
     }
     $event = \asb\Event::findOrFail($id);
     $roles = EventRole::where('event_id', '=', $event->id)->get();
     $dates = EventDate::where('event_id', '=', $event->id)->get();
     $attachments = EventAttachment::where('event_id', '=', $event->id)->get();
     $comments = EventComment::where('event_id', '=', $event->id)->get();
     $inventories = Equipment::all();
     $scheduled = EventEquipment::where('event_id', '=', $event->id)->get();
     return View::make('events.show', compact('event', 'roles', 'dates', 'attachments', 'comments', 'inventories', 'scheduled'));
 }
コード例 #5
0
 public function addInventory($id)
 {
     if (!Sentry::getUser()) {
         return Redirect::route('sessions.create');
     }
     $validator = Validator::make($data = Input::all(), InvoiceLine::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     if ($data['quantity'] > Equipment::where('id', '=', $data['item_id'])->first()->quantity) {
         return Redirect::back();
     }
     $data['type'] = 0;
     $data['invoice_id'] = $id;
     InvoiceLine::create($data);
     return Redirect::route('finances.index');
 }
コード例 #6
0
 /**
  * @see EquipmentTypeInterface::delete()
  * @return bool
  */
 public function delete()
 {
     if ($this->equipment_type_id and $this->equipment_type) {
         if ($this->get_children() != null) {
             return false;
         } else {
             $equipment_array = Equipment::list_entries_by_type_id($this->equipment_type_id);
             if (!is_array($equipment_array)) {
                 return $this->equipment_type->delete();
             } else {
                 if (count($equipment_array) == 0) {
                     return $this->equipment_type->delete();
                 } else {
                     return false;
                 }
             }
         }
     } else {
         return false;
     }
 }
コード例 #7
0
 /**
  * Remove the specified inventory from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     if (!Sentry::getUser()) {
         return Redirect::route('sessions.create');
     }
     Equipment::destroy($id);
     return Redirect::route('inventories.index');
 }
コード例 #8
0
ファイル: class.Event.php プロジェクト: name256/crm42
	function addEventDate($runat,$event_id,$event_date='',$start_time='',$end_time=''){
		ob_start();			
		$this->event_id=$event_id;
		switch($runat) {
			case 'local':
				$FormName='FrmAddDate';				
				$ControlNames=array("event_date"	=>array('event_date',"''","Please Select Event Date ","span_event_date")															
									);
										
				$ValidationFunctionName="CheckValidity";
				$JsCodeForFormValidation=$this->validity->ShowJSFormValidationCode($FormName,$ControlNames,$ValidationFunctionName,$SameFields,$ErrorMsgForSameFields);
				echo $JsCodeForFormValidation;						
				?>				
				<script type="text/javascript">
				function checkTime(start_time,end_time){					
					var temp_start1 = new Array();
					var temp_end1 = new Array();
					var temp_start = new Array();
					var temp_end = new Array()
					var flag=0;
					temp_start1 = start_time.split(" ");
					temp_end1 = end_time.split(" ");
					temp_start = temp_start1[0].split(":");
					temp_end = temp_end1[0].split(":");
									
					if(temp_start1[1]=='pm') {
						temp_start[0]=parseInt(temp_start[0])+12;
					}
						
					if(temp_end1[1]=='pm') {
						temp_end[0]=parseInt(temp_end[0])+12;
					}
					if(parseInt(temp_start[0]) > parseInt(temp_end[0])) {
						flag=1;
						}
					else if(parseInt(temp_start[0]) == parseInt(temp_end[0]) && parseInt(temp_start[1]) > parseInt(temp_end[1])) {
						flag=1;
						}
					if(flag==1) { alert('Start time is greater then end time !!'); return false; }
					else return true;			
				
				}				
				
				</script>				
				<div class="prl">&nbsp;</div>
				<div id="lightbox">
				
					<div style="background-color:#ADC2EB;" align="left" class="ajax_heading">
					<div id="TB_ajaxWindowTitle">Add Event Date</div>
					<div id="TB_closeAjaxWindow"><a href="javascript:void(0)" onclick="javascript: document.getElementById('div_event').style.display='none';jQuery.ptTimeSelect.closeCntr();"><img border="0" src="images/close.gif" alt="close" /></a></div>
				</div>
				<div  class="white_content"> 
				<div style="padding:20px;" class="form_main">
				<ul id="error_list">
						<li><span id="span_event_date"></span></li>									
				</ul>		
				<form name="<?php echo $FormName; ?>" method="post" action="" enctype="multipart/form-data" >
				<table class="table" width="100%">
				<tr>
					<th>Event Date</th><td>
					<?php 
					if($event_date=='')
					{
					  
						$sql = "select * from ".EM_DATE." where event_id= ".$this->event_id." order by  event_date desc limit 1";
						$result = $this->db->query($sql,__FILE__,__lINE__);			
						$row = $this->db->fetch_array($result);		
						$d = explode("-",$row['event_date']);		
						if($row['event_date']) $event_date= date("Y-m-d",mktime(0, 0, 0, $d[1], ($d[2]+1), $d[0]));
						else $event_date= date("Y-m-d");												
					}
					?>
				<input name="event_date" type="text"  id="event_date" value="<?php echo $event_date;?>" readonly="true"/>			
				<script type="text/javascript">	
				 
				 function start_cal()  {				 
				 new Calendar({
				 inputField   	: "event_date",
				 dateFormat		: "%Y-%m-%d",
				 trigger		: "event_date",
				 weekNumbers   	: true,
				 bottomBar		: true,	
				 selected       : <?php echo $event_date;?>,			 
				 onSelect		: function() {
										this.hide();
										document.<?php echo $FormName;?>.event_date.value=this.selection.print("%Y-%m-%d");									
									}				
				  });
				  }
				
				</script>
				<a href="javascript:void(0);" onclick="javascript: document.<?php echo $FormName;?>.event_date.value='';"><img src="images/trash.gif" border="0"/></a>		
					</td>
					<th>Start Time</th>
					<td><input id='start_time' name="start_time" type='text' value="00:00 am" size="8" maxlength="8" ></td>
					</td>
					<th>End Time</th>
					<td><input id='end_time' name="end_time" type='text' value="00:00 pm" size="8" maxlength="8" ></td>
					<td><input type="button" name="submit" value="Add" id="submit" onClick="javascript: if(<?php echo $ValidationFunctionName; ?>()) { if(checkTime(this.form.start_time.value,this.form.end_time.value)) {  evt.checkConflict(this.form.event_date.value,'<?php echo $event_id; ?>',{onUpdate: function(response,root){
					res_arr = response.split('^');
					if(res_arr[0]>0 || res_arr[1]>0){
					 if(confirm('you have conflict in '+res_arr[0]+' contact(s) <?php if(count($_SESSION[contact_conflict])>0){ echo "with contact id(s) ";
					 for($k=0;$k<count($_SESSION[contact_conflict]);$k++)
					 	echo $_SESSION[contact_conflict][$k].","; } ?> and '+res_arr[1]+' equipment(s) <?php if(count($_SESSION[equipment_conflict])>0){ echo "with equipment id(s) ";
					 		for($k=0;$k<count($_SESSION[equipment_conflict]);$k++)
					 	echo $_SESSION[equipment_conflict][$k].","; } ?>.\nDo you wish to continue.'))
					 {					 	
						if(res_arr[0]>0){
							evt.addTaskForContact('<?php echo $event_id; ?>',{preloader:'prl'});
						}
						if(res_arr[1]>0){
							evt.addTaskForEquipment('<?php echo $event_id; ?>',{preloader:'prl'});
						}
						evt.addEventDate('server','<?php echo $event_id; ?>',document.getElementById('event_date').value,document.getElementById('start_time').value,document.getElementById('end_time').value,{target:'div_event', preloader: 'prl'});
					 } else {
					 document.getElementById('div_event').style.display='none';
					 evt.ShowEventDate('<?php echo $event_id ?>',{target:'event_date',preloader: 'prl'});
					 }					 
				} else {
						evt.addEventDate('server','<?php echo $event_id; ?>',document.getElementById('event_date').value,document.getElementById('start_time').value,document.getElementById('end_time').value,{target:'div_event', preloader: 'prl'});
					}
					
					}, preloader: 'prl'});   } } jQuery.ptTimeSelect.closeCntr();return false;" /></td>
					</tr>
					</table>
				  </form>
					</div></div></div>
				<?php
				break;
			case 'server':
								
				$sql_date = "select event_date from ".EM_DATE." where event_id= '".$event_id."'";
				$result_date = $this->db->query($sql_date,__FILE__,__LINE__);
				while($row_date = $this->db->fetch_array($result_date))
					if($row_date['event_date']==$event_date) $flag=1;				
				if($flag==1) {
					?><script> alert("Select a new date!! This date is already exist!!");
						evt.addEventDate('local','<?php echo $this->event_id;?>',
						{ onUpdate: function(response,root){
							 document.getElementById('div_event').innerHTML=response;
		  				 	 document.getElementById('div_event').style.display='';
							 start_cal();					 					 
							 }, preloader: 'prl'
						} );							
						</script> <?php				
					}
				else {
					$insert_sql_array[event_date] = $event_date;
					$insert_sql_array[end_time] = $end_time;
					$insert_sql_array[start_time] = $start_time;
					$insert_sql_array[event_id] = $event_id;	
					$this->db->insert(EM_DATE,$insert_sql_array);
					$con = new Event_Contacts();
					$sql = "select * from ".EM_DATE." where event_id= '".$event_id."'";
					$result = $this->db->query($sql,__FILE__,__LINE__);
					
					$sql_staff = "select * from ".EM_STAFFING." where event_id= '".$event_id."' and status='Staffed'";
					$result_staff = $this->db->query($sql_staff,__FILE__,__LINE__);
					while($row_staff = $this->db->fetch_array($result_staff)) {
					  if($row_staff[contact_id]){
						while($row = $this->db->fetch_array($result)) {
							$con->Availability($row_staff[contact_id],$event_id,$row['event_date'],$row['start_time'],$row['end_time'],'Event Assigned');
						}
					  }
					}
					/********************************************/
					$sql = "select * from ".EM_EVENT." where event_id= '".$event_id."'";
					$result = $this->db->query($sql,__FILE__,__LINE__);
					$row = $this->db->fetch_array($result);
					if(count($_SESSION[equipment_conflict])>0){
						$sql_eve = "select * from ".EM_EVENT_EQUIPMENT." where event_id= '".$event_id."'";
						$result_eve = $this->db->query($sql_eve,__FILE__,__LINE__);
						while($row_eve = $this->db->fetch_array($result_eve)) {
						  $sql_avail = "update ".EM_EQUIPMENT_AVAILABILITY." set `status`='".$row[group_event_id]."' where `event_id`= '".$event_id."' and `unavailability_date`='".$event_date."' and `equipment_id`='".$row_eve[equipment_id]."'";
						  ?><script type="text/javascript">alert('<?php echo $sql_avail; ?>')</script><?
						  $this->db->query($sql_avail,__FILE__,__LINE__);
						}
					} 
					else {
						$equipment = new Equipment();
						$sql = "select * from ".EM_DATE." where event_id= '".$event_id."'";
						$result = $this->db->query($sql,__FILE__,__LINE__);
						
						$sql_equip = "select * from ".EM_EVENT_EQUIPMENT." where event_id= '".$event_id."'";
						$result_equip = $this->db->query($sql_equip,__FILE__,__LINE__);
						while($row_equip = $this->db->fetch_array($result_equip)) {
							while($row = $this->db->fetch_array($result)) {
								$equipment->assignEquipment($row_equip[equipment_id],$event_id);
							}
						}
					}
				}
				?>
				<script type="text/javascript">
				document.getElementById('div_event').innerHTML='';
				evt.ShowEventDate('<?php echo $this->event_id ?>',{target:'event_date',preloader: 'prl'});
				</script>
				<?php				
				break;
		}
		$html = ob_get_contents();
		ob_end_clean();
		return $html;
	} 
コード例 #9
0
 public function init()
 {
     $this->equipments = Equipment::model()->findMyEquipments();
 }
コード例 #10
0
**********************************************************************/
require 'staff.inc.php';
require_once EQUIPMENT_INCLUDE_DIR . 'class.equipment.php';
$equipment = $category = null;
if ($_REQUEST['id'] && !($equipment = Equipment::lookup($_REQUEST['id']))) {
    $errors['err'] = 'Unknown or invalid equipment';
}
if ($_REQUEST['cid'] && !$equipment && !($category = Equipment_Category::lookup($_REQUEST['cid']))) {
    $errors['err'] = 'Unknown or invalid equipment category';
}
if ($_POST) {
    $errors = array();
    switch (strtolower($_POST['do'])) {
        case 'create':
        case 'add':
            if ($equipment = Equipment::add($_POST, $errors)) {
                $msg = 'Equipment added successfully';
            } elseif (!$errors['err']) {
                $errors['err'] = 'Unable to add Equipment. Try again!';
            }
            break;
        case 'update':
        case 'edit':
            if (!$equipment) {
                $errors['err'] = 'Invalid or unknown Equipment';
            } elseif ($equipment->update($_POST, $errors)) {
                $msg = 'Equipment updated successfully';
                $_REQUEST['a'] = null;
                //Go back to view
                $equipment->reload();
            } elseif (!$errors['err']) {
コード例 #11
0
ファイル: UserController.php プロジェクト: josmel/hostpots
 public function getDeleteEquipment($id)
 {
     $table = null;
     if (!empty($id)) {
         $table = Equipment::whereId($id);
         $table->delete();
     }
     return response()->json(array('msg' => 'ok', 'state' => 1, 'data' => null));
 }
コード例 #12
0
 function startElement($parser, $tagName, $attrs)
 {
     switch ($tagName) {
         case "EQUIPMENT":
             $equipment = new Equipment();
             $equipment->parse($parser, $this);
             $this->equipment[] = $equipment;
             break;
         default:
             break;
     }
 }
コード例 #13
0
 /**
  *
  */
 public function __construct()
 {
     parent::setLocation(Equipment::CHEST);
     parent::__construct();
 }
コード例 #14
0
ファイル: equipment.io.php プロジェクト: suxinde2009/www
 /**
  * @throws EquipmentIDMissingException
  */
 public static function detail()
 {
     if ($_GET['id']) {
         $equipment = new Equipment($_GET['id']);
         self::type_detail($equipment->get_type_id(), $equipment->get_owner_id());
     } else {
         throw new EquipmentIDMissingException();
     }
 }
コード例 #15
0
 public function getRates()
 {
     return $this->equipment->getRates();
 }
コード例 #16
0
        redirect_to(array('location' => 'equipment.php' . (isset($_REQUEST['id']) ? "?id=" . intval($_REQUEST['id']) : ""), 'status' => 'One or more required fields are missing. Please check your input and try again.'));
    }
    //ensure that this facility exists.
    try {
        $facility = new Facility($database, $_POST['equipment']['facility_id']);
    } catch (Exception $e) {
        redirect_to(array('location' => 'equipment.php' . (isset($_REQUEST['id']) ? "?id=" . intval($_REQUEST['id']) : ""), 'status' => 'This facility does not exist.', 'class' => 'error'));
    }
    //ensure that this machine type exists.
    try {
        $machineType = new Machine($database, $_POST['equipment']['machine_id']);
    } catch (Exception $e) {
        redirect_to(array('location' => 'equipment.php' . (isset($_REQUEST['id']) ? "?id=" . intval($_REQUEST['id']) : ""), 'status' => 'This machine does not exist.', 'class' => 'error'));
    }
    try {
        $equipment = new Equipment($database, intval($_REQUEST['id']));
    } catch (Exception $e) {
        redirect_to(array('location' => 'equipment.php' . (isset($_REQUEST['id']) ? "?id=" . intval($_REQUEST['id']) : ""), 'status' => 'This equipment does not exist.', 'class' => 'error'));
    }
    $equipmentID = $equipment->create_or_update($_POST['equipment']);
    if ($equipmentID) {
        redirect_to(array('location' => 'equipment.php?action=view&id=' . intval($equipmentID), 'status' => 'Successfully ' . (intval($_REQUEST['id']) == 0 ? 'created' : 'updated') . ' equipment.', 'class' => 'success'));
    } else {
        redirect_to(array('location' => 'equipment.php' . (isset($_REQUEST['id']) ? "?id=" . intval($_REQUEST['id']) : ""), 'status' => 'An error occurred while ' . (intval($_REQUEST['id']) == 0 ? 'creating' : 'updating') . ' this equipment. Please try again.', 'class' => 'error'));
    }
} elseif ($_REQUEST['action'] == 'get_parameters' && isset($_REQUEST['id']) && is_numeric($_REQUEST['id'])) {
    // return a js response instantiating all the parameters and values for this equipment.
    try {
        $equipment = new Equipment($database, intval($_REQUEST['id']));
    } catch (Exception $e) {
        echo json_encode(array());
コード例 #17
0
ファイル: recipe.php プロジェクト: geoffhumphrey/brewblogger
 function startElement($parser, $tagName, $attrs)
 {
     $this->tag = $tagName;
     switch ($tagName) {
         case "HOPS":
             $hops = new Hops();
             $hops->parse($parser, $this);
             $this->hops = $hops;
             break;
         case "FERMENTABLES":
             $fermentables = new Fermentables();
             $fermentables->parse($parser, $this);
             $this->fermentables = $fermentables;
             break;
         case "YEASTS":
             $yeasts = new Yeasts();
             $yeasts->parse($parser, $this);
             $this->yeasts = $yeasts;
             break;
         case "STYLE":
             $style = new Style();
             $style->parse($parser, $this);
             $this->style = $style;
             break;
         case "MASH":
             $mash = new Mash();
             $mash->parse($parser, $this);
             $this->mash = $mash;
             break;
         case "WATER":
             // beerXML SPEC DOES NOT INCLUDE A WATERS TAG, ONLY WATER...BEERSMITH IS IMPLEMENTING INCORRECTLY
             $water = new Waters();
             $water->parse($parser, $this);
             $this->water = $water;
             break;
         case "MISCS":
             $miscs = new Miscs();
             $miscs->parse($parser, $this);
             $this->miscs = $miscs;
             break;
         case "EQUIPMENT":
             // SKIPPING EQUIPMENTS OBJECT AS BEERSMITH DOES NOT IMPLEMENT CORRECTLY
             $equipment = new Equipment();
             $equipment->parse($parser, $this);
             $this->equipments = $equipment;
             break;
         default:
             break;
     }
 }
コード例 #18
0
ファイル: equipment.class.php プロジェクト: suxinde2009/www
 /**
  * @see EventListenerInterface::listen_events()
  * @param object $event_object
  * @return bool
  */
 public static function listen_events($event_object)
 {
     if ($event_object instanceof UserDeletePrecheckEvent) {
         $equipment_array = self::list_entries_by_user_id($event_object->get_user_id());
         if (is_array($equipment_array)) {
             if (count($equipment_array) >= 1) {
                 return false;
             }
         }
     }
     if ($event_object instanceof ItemUnlinkEvent) {
         if (($equipment_id = EquipmentIsItem_Access::get_entry_by_item_id($event_object->get_item_id())) != null) {
             $equipment = new Equipment($equipment_id);
             if ($equipment->delete() == false) {
                 return false;
             }
         }
     }
     return true;
 }
コード例 #19
0
 public function sortEquipments($position)
 {
     $i = 1;
     foreach ($position as $id) {
         $model = Equipment::model()->findByPk($id);
         $model->position = $i;
         $model->save();
         $i++;
     }
 }
コード例 #20
0
 public function __construct()
 {
     parent::setLocation(Equipment::ONE_HAND);
     parent::__construct();
 }
コード例 #21
0
ファイル: equipment.ajax.php プロジェクト: suxinde2009/www
 /**
  * @param array $get_array
  * @param integer $type_id
  */
 public static function add_as_item($get_array, $type_id)
 {
     global $user, $transaction;
     if ($get_array and is_numeric($type_id)) {
         $transaction_id = $transaction->begin();
         $equipment = new Equipment(null);
         $equipment_add_successful = $equipment->create($type_id, $user->get_user_id());
         if ($equipment_add_successful) {
             $item_id = $equipment->get_item_id();
             $item_add_event = new ItemAddEvent($item_id, unserialize($get_array), null);
             $event_handler = new EventHandler($item_add_event);
             if ($event_handler->get_success() == true) {
                 if ($transaction_id != null) {
                     $transaction->commit($transaction_id);
                 }
                 return "1";
             } else {
                 if ($transaction_id != null) {
                     $transaction->rollback($transaction_id);
                 }
                 throw new EquipmentCreateException();
             }
         } else {
             if ($transaction_id != null) {
                 $transaction->rollback($transaction_id);
             }
             throw new EquipmentCreateException();
         }
     } else {
         throw new EquipmentIDMissingException();
     }
 }
コード例 #22
0
ファイル: index.php プロジェクト: Romandre90/vectortraveler
<ul id='treeview' class='filetree'>
    <?php 
$ul = "";
$projectId = 0;
$componentId = 0;
foreach ($query as $q) {
    $pname = $q['pname'];
    $pid = $q['pid'];
    $cname = $q['cname'];
    $cid = $q['cid'];
    $ename = $q['ename'];
    $eid = $q['eid'];
    $project = Project::model()->findByPk($pid);
    $component = Components::model()->findByPk($cid);
    $travelers = Equipment::model()->findByPk($eid)->travelers;
    if ($projectId != $pid) {
        $projectId = $pid;
        $componentId = 0;
        $status = 0;
        echo "{$ul}{$ul}";
        $ul = "";
        if ($project->hide) {
            $style = "";
        } else {
            $style = "style='display:none'";
        }
        ?>
            <li class="p<?php 
        echo $pid;
        ?>