Example #1
0
function recursion($a)
{
    if ($a <= 20) {
        echo $a . "<br>";
        recursion($a + 1);
    }
}
Example #2
0
function recursion($a)
{
    if ($a < 10) {
        echo "{$a}<br />";
        recursion($a + 1);
    }
}
Example #3
0
function recursion($a)
{
    if ($a < 20) {
        echo "{$a}\n";
        recursion($a + 1);
    }
}
Example #4
0
function recursion($value)
{
    echo "recursion({$value})" . PHP_EOL;
    if ($value === 0) {
        return 0;
    }
    return recursion(--$value);
}
Example #5
0
 public function index()
 {
     // 加载用户信息
     $user = M('user')->where(array('id' => $_SESSION['uid']))->field('avatar')->find();
     $this->userAvatar = $user['avatar'];
     //加载导航
     $this->nav = recursion(M('screen')->where(array('type' => 'navAdmin'))->order('sort')->select());
     $this->display();
 }
Example #6
0
function recursion($array, $name = "child", $pid = 0)
{
    $arr = array();
    foreach ($array as $v) {
        if ($v['pid'] == $pid) {
            $v[$name] = recursion($array, $name, $v['id']);
            $arr[] = $v;
        }
    }
    return $arr;
}
Example #7
0
function recursion($a){
	if($a==0){
		return 0;
	}
	else if($a==1){
		return 1;

	}
	else{
		return recursion($a-1) + recursion($a-2);

	}
	for($i=0;$i<$a; $i--){
		echo recursion($a);
	}
}
Example #8
0
function display($i)
{
    recursion($i);
}
function spantag($spanoptions, $text)
{
    $prependtags = $appendtags = '';
    parsestyle($spanoptions, $prependtags, $appendtags);
    return $prependtags . recursion('span', $text, 'spantag') . $appendtags;
}
Example #10
0
 function ptag($poptions, $text)
 {
     $align = $this->getoptionvalue('align', $poptions);
     switch ($align) {
         case 'left':
         case 'center':
         case 'right':
             break;
         default:
             $align = '';
     }
     $prepend = $append = '';
     $this->parsestyle($poptions, $prepend, $append);
     if ($align) {
         $prepend .= "[align={$align}]";
         $append .= "[/align]";
     }
     $append .= "\n";
     return $prepend . recursion('p', $text, 'ptag') . $append;
 }
                if (!array_key_exists($value['source'], $flagweight)) {
                    insertweight($value['source'], bcdiv(1, 2, 5));
                }
            }
            $flagweight = array();
        }
    }
}
foreach ($weight as $key => $value) {
    if ($value == 0) {
        unset($weight[$key]);
    }
}
finalUseageCount($newdata);
calculatePuse($newdata);
recursion($newdata);
find($newdata, 0, 0, 0);
$useageWT = array();
for ($i = 0; $i < count($newdata); $i++) {
    $WMS = 1;
    if ($useageWC[$i] > 0) {
        $WMS = bcmul($WMS, $useageWC[$i], 4);
    }
    if ($useageNB[$i] > 0) {
        $WMS = bcmul($WMS, $useageNB[$i], 4);
    }
    if ($useageNLW[$i] > 0) {
        $WMS = bcmul($WMS, $useageNLW[$i], 4);
    }
    if ($useageWNLT[$i] > 0) {
        $WMS = bcmul($WMS, $useageWNLT[$i], 4);
Example #12
0
 public function addBuffer($name)
 {
     $data = recursion(M('screen')->where(array('type' => $name))->order('sort')->select());
     F($name, $data);
 }
Example #13
0
function recursion($user, $all_pages, $dpcs_data, $modify_style = 40)
{
    foreach ($user as $child_key => $child_value) {
        if ($modify_style == 40) {
            unset($dpcs_data['new_class']);
            $dpcs_data['new_class'] = '';
            $style = '';
        } else {
            $style = 'style="display:none;"';
        }
        ?>
			<tr onclick="lockRowUsingCheckbox();lockRow();" class="pane <?php 
        echo $dpcs_data['css_class'];
        ?>
 <?php 
        echo $child_value['class'];
        ?>
" <?php 
        echo $style;
        ?>
>	
							
					<td width="5%"  align="left">
							<input type="checkbox" name="tablechoice[]" value="<?php 
        echo $child_value['id'];
        ?>
" />
					</td>
		<td class="left" align="left" width="5%"><?php 
        echo $child_value['id'];
        ?>
</td>
		<td class="left" align="left" width="15%"><?php 
        echo $all_pages[$child_value['page_parent_id']];
        ?>
</td>
		<?php 
        if (isset($child_value['children']) && is_array($child_value['children'])) {
            $modify_style_1 = round($modify_style / 2);
        } else {
            $modify_style_1 = $modify_style;
        }
        ?>
		<td class="left" align="left" width="20%" style="padding-left:<?php 
        echo $modify_style_1;
        ?>
px">
		<?php 
        if (isset($child_value['children']) && is_array($child_value['children'])) {
            ?>
				<img src="<?php 
            echo base_url();
            ?>
/images/backend/crm_add.gif" alt="<?php 
            echo $child_value['page_name'];
            ?>
" title="<?php 
            echo $child_value['page_name'];
            ?>
" style="position:relative;top:-4px;cursor:pointer;" id="<?php 
            echo $child_value['page_name'];
            ?>
_<?php 
            echo $child_value['id'];
            ?>
" onclick="dpcs_show_hide('<?php 
            echo $child_value['page_name'];
            ?>
_<?php 
            echo $child_value['id'];
            ?>
');"/>
			<?php 
        }
        echo $child_value['page_name'];
        ?>
</td>
		<td class="left" align="left" width="5%"><?php 
        echo mysql_to_human($child_value['created'], 'Y-m-d');
        ?>
</td>
		<td align="left"  width="2%">
		<?php 
        echo $child_value['rank'];
        ?>
</td>
		<?php 
        if (isset($dpcs_data['page_rank_count'][$child_value['page_parent_id']])) {
            $count_rows = $dpcs_data['page_rank_count'][$child_value['page_parent_id']];
        } else {
            $count_rows = 0;
        }
        ?>
		<td align="left" width="3%">
		&nbsp;&nbsp;<img src="<?php 
        echo base_url();
        ?>
images/backend/save_file.jpg" onclick="change_rank_customized('<?php 
        echo $child_value['id'];
        ?>
','<?php 
        echo $child_value['rank'];
        ?>
','<?php 
        echo $count_rows;
        ?>
','<?php 
        echo $dpcs_data['form_name'];
        ?>
','<?php 
        echo site_url($dpcs_data['page_name'] . '/change_rank');
        ?>
','<?php 
        echo $child_value['page_parent_id'];
        ?>
');"   style="cursor:pointer;" title="Click to Change Rank" alt="Click to Change Rank"  />		
		</td>
		<?php 
        if ($dpcs_data['session_user'] == '*****@*****.**') {
            ?>
		<td align="center" valign="middle" width="4%"><label class="status_label"><?php 
            echo $child_value['hide_client'];
            ?>
</label>
                    <?php 
            if ($child_value['hide_client'] == 1) {
                ?>
										
                    <img src="<?php 
                echo base_url();
                ?>
images/backend/page_right.jpg"  alt="Click here to make this record visible to client" title="Click here to make this record visible to client" border="0" width="18" height="18" class="cursor_pointer" onclick="change_hide_client('<?php 
                echo site_url($dpcs_data['page_name'] . '/inactive_hide_client/' . $child_value['id']);
                ?>
','0');"/>
                    <?php 
            } else {
                ?>
                   
										 <img src="<?php 
                echo base_url();
                ?>
images/backend/page_wrong.jpg" alt="Click here to make this record hidden to client" title="Click here to make this record hidden to client" border="0" width="18" height="18" class="cursor_pointer"  onclick="change_hide_client('<?php 
                echo site_url($dpcs_data['page_name'] . '/active_hide_client/' . $child_value['id']);
                ?>
','1');"/>
                    <?php 
            }
            ?>
        </td><?php 
        }
        ?>
		<td align="centre" width="4%"><label class="status_label"><?php 
        echo $child_value['menu_frontend'];
        ?>
</label>
                    <?php 
        if ($child_value['menu_frontend'] == 1) {
            ?>
                    <img src="<?php 
            echo base_url();
            ?>
images/backend/page_right.jpg" alt="Click here to hide footer" title="Click here to hide from Front End Menu" border="0" width="18" height="18" class="cursor_pointer" onclick="display_footer('<?php 
            echo site_url($dpcs_data['page_name'] . '/inactive_frontend_menu/' . $child_value['id']);
            ?>
','0');"/>
                    <?php 
        } else {
            ?>
                    <img src="<?php 
            echo base_url();
            ?>
images/backend/page_wrong.jpg" alt="Click here to display footer" title="Click here to Show on Front End Menu" border="0" width="18" height="18" class="cursor_pointer" onclick="display_footer('<?php 
            echo site_url($dpcs_data['page_name'] . '/active_frontend_menu/' . $child_value['id']);
            ?>
','1');"/>
                    <?php 
        }
        ?>
        </td>
		<td align="center" valign="middle" width="6%"><label class="status_label"><?php 
        echo $child_value['display_footer'];
        ?>
</label>
                    <?php 
        if ($child_value['display_footer'] == 1) {
            ?>
                    <img src="<?php 
            echo base_url();
            ?>
images/backend/page_right.jpg" alt="Click here to hide footer" title="Click here to hide footer" border="0" width="18" height="18" class="cursor_pointer" onclick="display_footer('<?php 
            echo site_url($dpcs_data['page_name'] . '/hide_footer/' . $child_value['id']);
            ?>
','0');"/>
                    <?php 
        } else {
            ?>
                    <img src="<?php 
            echo base_url();
            ?>
images/backend/page_wrong.jpg" alt="Click here to display footer" title="Click here to display footer" border="0" width="18" height="18" class="cursor_pointer" onclick="display_footer('<?php 
            echo site_url($dpcs_data['page_name'] . '/show_footer/' . $child_value['id']);
            ?>
','1');"/>
                    <?php 
        }
        ?>
        </td>
		<td align="left" width="4%"><label class="status_label"><?php 
        echo $child_value['status'];
        ?>
</label>
                    <?php 
        if ($child_value['status'] == 1) {
            ?>
                    <img src="<?php 
            echo base_url();
            ?>
images/backend/page_right.jpg" alt="Click here to make this record inactive" title="Click here to make this record inactive" border="0" width="18" height="18" class="cursor_pointer" onclick="change_active('<?php 
            echo site_url($dpcs_data['page_name'] . '/inactive/' . $child_value['id']);
            ?>
','0');"/>
                    <?php 
        } else {
            ?>
                    <img src="<?php 
            echo base_url();
            ?>
images/backend/page_wrong.jpg" alt="Click here to make this record active" title="Click here to make this record active" border="0" width="18" height="18" class="cursor_pointer" onclick="change_active('<?php 
            echo site_url($dpcs_data['page_name'] . '/active/' . $child_value['id']);
            ?>
','1');"/>
                    <?php 
        }
        ?>
         </td>
		 <td align="right" width="10%">
    <?php 
        if ($dpcs_data['session_user'] == '*****@*****.**') {
            $edit_preview_indicator = 1;
        } else {
            if ($child_value['hide_client'] == 1) {
                $edit_preview_indicator = 0;
            } else {
                $edit_preview_indicator = 1;
            }
        }
        if ($edit_preview_indicator == 1) {
            ?>
		<a href="<?php 
            echo site_url($dpcs_data['page_name'] . "/edit/" . $child_value['id']);
            ?>
" title="Edit record with id: <?php 
            echo $child_value['id'];
            ?>
">	
	  <img src="<?php 
            echo base_url();
            ?>
images/backend/page_edit.jpg" title="Edit record with id: <?php 
            echo $child_value['id'];
            ?>
" alt="Edit record with id: <?php 
            echo $child_value['id'];
            ?>
" border="0" class="cursor_pointer" width="18" height="18"  />
	  </a>&nbsp;&nbsp;
	  <img src="<?php 
            echo base_url();
            ?>
images/backend/page_delete.jpg" title="Delete record with id: <?php 
            echo $child_value['id'];
            ?>
" alt="Delete record with id: <?php 
            echo $child_value['id'];
            ?>
" border="0" onclick="javascript:confirm_delete('<?php 
            echo site_url($dpcs_data['page_name'] . '/delete/' . $child_value['id']);
            ?>
');" class="cursor_pointer" width="18" height="18"  />
	  &nbsp;&nbsp;
		<?php 
        }
        ?>
	  <a target="_blank" href="<?php 
        echo site_url($child_value['page_name']);
        ?>
" title="Preview record with id: <?php 
        echo $child_value['id'];
        ?>
">
	  <img src="<?php 
        echo base_url();
        ?>
images/backend/page_preview.jpg" alt="Preview user with id: <?php 
        echo $child_value['id'];
        ?>
" title="Preview user with id: <?php 
        echo $child_value['id'];
        ?>
" border="0"  class="cursor_pointer" width="18" height="18" />
	  </a>
		<?php 
        if ($child_value['history_id'] != 0) {
            ?>
								 <a target="_blank" href="<?php 
            echo site_url($dpcs_data['page_name'] . "/history/" . $child_value['id']);
            ?>
" title="Preview history record with id: <?php 
            echo $child_value['id'];
            ?>
">
								<img src="<?php 
            echo base_url();
            ?>
images/backend/history.jpg" alt="Preview history record with id: <?php 
            echo $child_value['id'];
            ?>
" title="Preview history record with id: <?php 
            echo $child_value['id'];
            ?>
" border="0"  class="cursor_pointer" width="18" height="18" />
								</a>
							<?php 
        }
        ?>
	
	 	 
                </td>
	
	</tr>
		<?php 
        if (isset($child_value['children']) && is_array($child_value['children'])) {
            //$dpcs_data['new_class'] .= ' '.$child_value['page_name'].'_'.$child_value['id'];
            $dpcs_data['new_class'] = $child_value['page_name'] . '_' . $child_value['id'];
            recursion($child_value['children'], $all_pages, $dpcs_data, $modify_style + 25);
        }
    }
}
Example #14
0
/**
 *
 * @do 递归菜单算法
 *
 * @access private
 * @author Nick
 * @copyright rockhippo
 * @param -
 * @return -
 *
 */
function recursion($menulist, $parent_menuid = 0)
{
    $arr = array();
    foreach ($menulist as $key => $val) {
        //根菜单
        if ($val['parent_menuid'] == $parent_menuid) {
            $val['child'] = recursion($menulist, $val['id']);
            if ($val['parent_menuid'] != 0) {
                $val['pattern'] = str_repeat('&nbsp;&nbsp;&nbsp;', $val['menu_lev']) . "└";
            } else {
                $val['pattern'] = "";
            }
            $arr[] = $val;
        }
    }
    return $arr;
}