Jump to content
  • 0

Классы и наследование


ekklesiast
 Share

Question

Есть некоторый класс и некоторая функция в нем

function createFolder()
{

$cId=$this->folders->cId;
$deskr=$this->escape_post('descr');
$name=$this->escape_post('name');
$path=translit($_POST['name']);
if (empty($path))
{
$this->err='<span style="color:red;font-weight:bold">Не введено имя папки.</span>';
$this->incfile='addfolder';
return false;
}

$added=$this->escape_post('added');
$visible=$this->escape_post('visible');
$date=date('y-m-d');

if ($this->folders->existsFolder($path))
{
$this->err='<span style="color:red;font-weight:bold">Папка «<span style="color:blue">'.$name.'</span>» уже существует. Невозможно создать.</span>';
$this->incfile='folder';
return false;
}
if ($this->escape_post('addnew'))
{
if (!$this->canCreateFolder())
{
$this->err='<span style="color:red;font-weight:bold">Превышен уровень допустимой вложености папок. Действие отменено.</span>';
$this->incfile='addfolder';
return false;
}
$query="INSERT INTO folders VALUES (NULL,
'$cId',
'$path',
'$name',
'$deskr',
'on',
'on',
'$date',
NULL)";
$loc=$this->get_url($this->folders->fullpath, 'view'); //создаем категорию
}

else
{
$query="UPDATE folders SET f_name='$name',
f_deskr='$deskr',
f_path='$path'
WHERE f_id='".$this->folders->cId."'";
$loc=$this->get_url($this->folders->parentpath, 'view'); //редактируем
}

$this->dbio->exec($query);
header ("location: " . $loc);
}

Нужно, чтобы один из его потомков после создания новой категории выполнил некоторые дополнительные действия. (именно создал новую директорию с именем $path) Как это можно реализовать лучше всего?

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. See more about our Guidelines and Privacy Policy