public function testDeleteMedia() { $picture = array('rel_type' => 'content', 'rel_id' => 3, 'title' => 'My new pic to del', 'media_type' => 'picture', 'src' => 'http://lorempixel.com/400/200/'); $saved_pic_id = save_media($picture); $picture_data = get_media_by_id($saved_pic_id); $to_delete = array('id' => $saved_pic_id); $delete = delete_media($to_delete); $title = $picture_data['title']; $picture_null = get_media_by_id($saved_pic_id); $this->assertEquals($picture_null, false); $this->assertEquals(is_array($picture_data), true); $this->assertEquals($title, 'My new pic to del'); $this->assertEquals(!$delete, false); }
/** Ajax xóa nhiều file */ function multi_delete_media($ids) { if (is_array($ids)) { foreach ($ids as $id) { delete_media($id); } } }
break; case 'rename_media_group': /** Đổi tên nhóm media */ $args = array(); $args['group_name'] = hm_post('group_name'); $args['group_id'] = hm_post('group_id', 0); echo rename_media_group($args); break; case 'del_media_group': /** Xóa nhóm media */ $args = array(); $args['group_id'] = hm_post('group_id', 0); echo del_media_group($args); break; case 'add_media': /** Upload media */ echo add_media(); break; case 'delete_media': /** Delete media */ delete_media(hm_post('id')); break; case 'multi_delete_media': /** Delete multi media */ multi_delete_media(hm_post('ids')); break; case 'thumbnail_media': /** Trả về link thumbnail của file */ echo thumbnail_media(hm_post('id')); break; }
default: } if ($event->getField('FixturesEnable') == TRUE) { $event->brackets(true); } $event->setFieldDB('IsChanged', 1); header("Location: eventinfo.php?eventid={$event_id}"); exit; } if (isset($_POST['addmedia'])) { $event_id = $_POST['eventid']; $match_id = $_POST['matchid']; $match = new Match($match_id); $media_type = $_POST['mediatype']; $media_path = $_POST['mediapath']; $submitter = USERID; if (preg_match("/http:\\/\\//", $media_path)) { $match->add_media($submitter, $media_path, $media_type); } header("Location: matchinfo.php?matchid={$match_id}"); exit; } if (isset($_POST['del_media']) && $_POST['del_media'] != "") { $match_id = $_POST['matchid']; $media = $_POST['del_media']; delete_media($media); header("Location: matchinfo.php?matchid={$match_id}"); exit; } // should not be here -> redirect header("Location: events.php");