示例#1
0
echo form::submit('submit', Kohana::lang('search.go'),'class=button');
echo '<br />';
echo form::close();
?>
<div class="cleaner">&nbsp;</div>
<hr />

<? // Rendering products results ?>
<h2><?php 
echo Kohana::lang('search.results_for_products');
?>
</h2>
<?php 
if (count($data) > 0) {
    ?>
	<? echo cat::items($data); ?>
<?php 
} else {
    ?>
	<p><?php 
    echo Kohana::lang('search.no_result');
    ?>
</p>
<?php 
}
?>
<div class="cleaner">&nbsp;</div>
<hr />
<? // Rendering pages results ?>
<h2><?php 
echo Kohana::lang('search.results_for_pages');
示例#2
0
 /**
  * Delete product
  * @param integer id of product
  * @return void
  */
 public function delete($id)
 {
     // Check user permission
     if (user::is_got()) {
         // Settings
         $this->set_title(Kohana::lang('eshop.delete_product'));
         $this->add_breadcrumb(Kohana::lang('eshop.delete_product'), url::current());
         if ($_POST) {
             if (isset($_POST['yes'])) {
                 // clicked on yes = delete
                 $cat = $this->products->get_product_cat($id);
                 $cat = $cat[0];
                 $status = $this->products->delete_data($id);
                 // Also delte images if deletition was successful
                 if ($status == TRUE) {
                     gallery::delete_images($id, 'products');
                 }
                 url::redirect('/cat/' . $cat . '/' . cat::get_name($cat));
             } else {
                 url::redirect('/product/' . $id . '/' . string::to_url(product::get_name($id)));
             }
         }
         // page
         $this->template->content = new View('admin/product_delete');
     } else {
         url::redirect('/denied');
     }
 }
示例#3
0
文件: oo5.php 项目: anatai/manray
<?php

abstract class animal
{
    function makenoise()
    {
        echo $this->noise;
    }
}
//the extends bit is called inheritance. both classes cat and dog
//'inherit' makenoise from animal in this case
class cat extends animal
{
    public $noise = 'meow';
}
$cat = new cat();
$cat->makenoise();
class dog extends animal
{
    public $noise = 'woof';
}
$dog = new dog();
$dog->makenoise();
示例#4
0
文件: oo2.php 项目: anatai/manray
<?php

class cat
{
    function makenoise()
    {
        return 'purr';
    }
    function speed()
    {
        return 'nippy';
    }
    //$this is a special variable that refers to the class's scope
    function output()
    {
        $noise = $this->makenoise();
        $speed = $this->speed();
        echo 'the cat says ' . $noise . ' and is very ' . $speed;
    }
}
$cat = new cat();
$cat->output();
示例#5
0
 /**
  * Delete category
  * @return void
  * @param integer id of category
  */
 public function delete($id)
 {
     // Check user permission
     if (user::is_got()) {
         // Settings
         $this->set_title(Kohana::lang('eshop.delete_cat'));
         $this->add_breadcrumb(Kohana::lang('eshop.delete_cat'), url::current());
         $errors = array();
         if ($_POST) {
             if (isset($_POST['yes'])) {
                 // clicked on yes = delete
                 if (count($this->cats->get_children($id)) != 0 or count($this->products->get(1, 1, $id))) {
                     $errors[] = Kohana::lang('eshop.cannot_be_deleted');
                 } else {
                     $parent = cat::get_parent($id);
                     $this->cats->delete_data($id);
                     if ($parent == 0) {
                         url::redirect('/');
                     } else {
                         url::redirect('/cat/' . $parent . '/' . cat::get_name($parent));
                     }
                 }
             } else {
                 url::redirect('/cat/' . $id . '/' . cat::get_name($id));
             }
         }
         // View
         $this->template->content = new View('admin/cat_delete');
         $this->template->content->errors = $errors;
     } else {
         url::redirect('/denied');
     }
 }
示例#6
0
 function identify()
 {
     return parent::identify('lion');
 }
示例#7
0
<?php

class animal
{
    public $name = "";
    public $age = 0;
    public function display()
    {
        echo "name " . $this->name . "<br>";
        echo "age " . $this->age . "<br>";
    }
}
class dog extends animal
{
}
class cat extends animal
{
}
$d = new dog();
$c = new cat();
$c->name = "meow";
$c->age = 67;
$d->name = "bow";
$d->age = 45;
$c->display();
$d->display();
示例#8
0
<?php

class cat
{
    public function show_output($prepend, $output = '')
    {
    }
}
$cat = new cat();
$cat->show_output('Files: ', trim(`cd .`));
// this gives invalid args to shell_exec
$cat->show_output('Files: ', `cd .`);
// this causes a segmentation fault
$cat->show_output(`cd .`);
// this causes a segmentation fault
function show_outputa($prepend, $output)
{
    echo "Okey";
}
show_outputa('Files: ', `cd .`);
// this works as expected
示例#9
0
	&nbsp;
</div>
<?php 
if (user::is_got()) {
    ?>
	<p><a href="/product/add/<?php 
    echo $id;
    ?>
"><?php 
    echo Kohana::lang('eshop.add');
    ?>
</a></p>
<?php 
}
?>
<? echo cat::items($products); ?>
<?php 
if (count($products) == 0) {
    ?>
	<em><?php 
    echo Kohana::lang('eshop.no_products');
    ?>
</em>
<?php 
}
?>
<div class="cleaner">&nbsp;</div>
<hr />
<?php 
echo $this->pagination->render();
?>
示例#10
0
 /**
  * Return array with ID and names 
  * @return 
  * @param object $ids
  */
 public function add_names($ids)
 {
     foreach ($ids as $row) {
         $ids[$row] = cat::get_name($row);
     }
     // solving problem with gaps
     $new = array();
     foreach ($ids as $key => $value) {
         if (!is_numeric($value)) {
             $new[$key] = $value;
         }
     }
     return $new;
 }
示例#11
0
文件: oo.php 项目: anatai/manray
<?php

class cat
{
    function makenoise()
    {
        return 'meow';
    }
    function speed()
    {
        return 'fast';
    }
}
$cat = new cat();
echo 'the cat says ' . $cat->makenoise() . ' and is very ' . $cat->speed();