protected static function looper($id, $flowid) { $trees = array(); $child = Step::where('parentid', '=', $id)->where('flowid', '=', $flowid)->get(); foreach ($child as $cvalue) { if (!empty($cvalue)) { $trees[$cvalue->stepid]['desc'] = $cvalue->step; $trees[$cvalue->stepid]['child'] = self::looper($cvalue->stepid, $flowid); } } return $trees; }
public static function listSteppages($current = NULL) { $pagelist = Page::all(); $arrayPages['data'] = array('Sila Pilih'); foreach ($pagelist as $value) { $regnav = Step::where('page', '=', $value->modulpageid)->first(); if (isset($value->action) && $value->actionalias != '' && $value->visible == 1 && (empty($regnav) or !empty($regnav) && $current != NULL ? $regnav->stepid == $current : empty($regnav))) { $arrayPages['data'][$value->modulpageid] = $value->actionalias; if (!empty($regnav) && $regnav->stepid == $current) { $arrayPages['selected'] = $regnav->page; } } } return $arrayPages; }
public function post_deletestep() { $input = Input::get(); Log::write('User', 'Delete Step ID ' . Step::find($input['id'])->step . ' by ' . Auth::user()->username); Step::find($input['id'])->delete(); Step::where('parentid', '=', $input['id'])->delete(); return Menu::flowtree($input['flowid']); }
public static function flowtree($flowid) { $structure = ''; $data = Step::steploop($flowid); if (!empty($data)) { $structure .= '<ul class="nav nav-list">'; foreach ($data as $key => $value) { $structure .= '<li>'; $structure .= '<a href="#" onclick="deleteStep(' . $key . ')" style="float:right"> <i class="icon-remove-sign"></i></a>'; $structure .= '<a href="#" onclick="editStep(' . $key . ')" style="float:right"> <i class="icon-edit"></i></a>'; $structure .= '<a href="#" onclick="addStep(' . $key . ')" ><i class="icon-bookmark"></i> ' . Str::title($value['desc']) . ' <i class="icon-plus-sign"></i></a>'; $structure .= self::looper($value['child']); $structure .= '</li>'; } $structure .= '</ul>'; } else { $structure = '<a href="#addDataModal" data-toggle="modal" >Add Steps <i class="icon-plus"></i></a>'; } return $structure; }