Пример #1
0
 function index($prod_id)
 {
     // production_id
     $parts = Part::find_all_by_production_id($prod_id, array('order' => 'id asc'));
     $results = array();
     foreach ($parts as $part) {
         $results[] = array('id' => $part->id, 'name' => $part->num . ' ' . $part->name . ' (' . count($part->processes) . ')', 'font' => array('color' => $part->is_done ? 'green' : 'black'), 'isParent' => count($part->processes) == 0 ? false : true, 'type' => 'part', 'icon' => $part->return_date ? get_path('/webroot/css/img/diy/3_return.jpg', true) : get_path('/webroot/css/img/diy/3.png', true));
     }
     echo json_encode($results);
 }