Example #1
0
 /**
  * (non-PHPdoc)
  * @see Bgtask_Storage::kill()
  */
 public function kill($pid)
 {
     $this->_objectModel->remove($pid, false);
     $this->_signalModel->clearSignals($pid);
     if (isset($this->_objects[$pid])) {
         unset($this->_objects[$pid]);
     }
     return true;
 }
Example #2
0
 /**
  * Tag Object
  *
  * This function allows you to pass in a string directly from a form, which is then
  * parsed for quoted phrases and special characters, normalized and converted into tags.
  * The tag phrases are then individually sent through the safe_tag() method for processing
  * and the object referenced is set with that tag.
  *
  * This method has been refactored to automatically look for existing tags and run
  * adds/updates/deletes as appropriate.
  *
  * Returns TRUE if successful, FALSE otherwise.
  *
  * @param  string           $tags          The raw string form of the tag to delete. See above for notes.
  * @param  Model            $object        The Model Object
  * @param  boolean|integer  $user_id       The User id [Optional]
  * @param  boolean          $skip_updates  Whether to skip the update portion for objects that haven't been tagged [Optional]
  *
  * @return	boolean
  */
 public function tagging($tags, Model $object, $user_id = FALSE, $skip_updates = TRUE)
 {
     if (!$user_id) {
         return FALSE;
     }
     if (!$object) {
         return FALSE;
     }
     $tags = self::explode($tags);
     $old_tags = $object->tags->find_all();
     $preserve_tags = array();
     $remove_tags = array();
     if (!$skip_updates and count($old_tags)) {
         foreach ($old_tags as $tag) {
             if (!in_array($tag->name, $tags)) {
                 $remove_tags[] = intval($tag->id);
             } else {
                 // We need to preserve old tags that appear (to save timestamps)
                 $preserve_tags[] = $tag->name;
             }
         }
     }
     if (count($remove_tags)) {
         // remove unexisting tags
         $object->remove('tags', $remove_tags);
     }
     $new_tags = array_diff($tags, $preserve_tags);
     $this->_tag_object_array($user_id, $object, $new_tags);
     return TRUE;
 }
Example #3
0
require_once "../model/session.php";
require_once "../model/base_model.php";
$controllerCalled = 1;
$model = new Model();
// $h = fopen("debug.txt", "a");
$page = $_SESSION['page'];
if (isset($_POST['id'])) {
    $data = json_decode($_POST['id'], true);
    // var_dump(json_decode($data, true));
    // fprintf($h, $data[0]." ".$page);
    // $path="uploads/20160304050432pmJRyUi7E.jpg";
    // if(unlink($path)) echo "Deleted file ";
    switch ($page) {
        case 'Post':
            # code...
            $model->remove("guardtours", $data, "poste_id");
            $model->remove("poste", $data, "id");
            break;
        case 'Guard':
            # code...
            $model->remove("guardtours", $data, "guard_id");
            $model->remove("guard", $data, "id");
            break;
        case 'Guard tours':
            # code...
            $model->remove("tours", $data, "guardtours_id");
            $model->remove("guardtours", $data, "id");
            break;
        case 'Tours':
            # code...
            $model->remove("tours", $data, "id");