コード例 #1
0
 public function act_set_help()
 {
     global $global;
     global $conf;
     $browse = new Browse();
     $id = $_GET['element_id'];
     $message = $_GET['wysiwyg'];
     $sql = "UPDATE help SET definition='{$message}' WHERE field_number ='{$id}'";
     $res = $browse->ExecuteNonQuery($sql);
     exit(0);
 }
コード例 #2
0
 /**
  * 显示当前面板内容
  * @Title: showPanel
  * @Description: todo(页面展示)
  * @author 管理员
  * @date 2015-06-30 19:36:36
  * @throws
  */
 public function showPanel()
 {
     import('@.ORG.Browse');
     $submodel = M("mis_system_panel_desing_sub");
     $sublist = $submodel->where("masid=15")->select();
     $scdmodel = D("SystemConfigDetail");
     $map["status"] = 1;
     foreach ($sublist as $key => $val) {
         $model = $val["modelname"];
         $fields = explode(",", $val["showtitle"]);
         $defaultwidth = (int) 100 / count($fields);
         $temp = explode(",", $val["showtitle"]);
         foreach ($temp as $tk => $tv) {
             $temparr = explode("|", $tv);
             if ($temparr[2]) {
                 $fields[$temparr[0]]['name'] = $temparr[0];
                 $fields[$temparr[0]]['width'] = $temparr[1];
                 $fields[$temparr[0]]['sort'] = $temparr[2];
             }
         }
         sortArray($fields, 'sort', 'asc', 'number');
         $detailList = $scdmodel->getDetail($model, true, "", "status");
         $sublist[$key]['link'] = __APP__ . "/" . $model . "/index";
         $sublist[$key]['rel'] = $model;
         $newd = array();
         foreach ($fields as $k => $v) {
             foreach ($detailList as $dk => $dv) {
                 if ($v['name'] == $dv['name']) {
                     $newd[$k] = $dv;
                     $newd[$k]['shows'] = 1;
                     $newd[$k]['sortnum'] = $v['sort'];
                     if (strpos('px', $v['width']) > 0 || strpos('PX', $v['width']) > 0 || strpos('Px', $v['width']) > 0) {
                         $newd[$k]['widths'] = $v['width'];
                     } else {
                         $newd[$k]['widths'] = $v['width'] ? $v['width'] . "%" : $defaultwidth . "%";
                     }
                 }
             }
         }
         $sublist[$key]["detailList"] = $newd;
         //具体数据1
         $listmodel = D($model);
         $val['num'] = $val['num'] ? $val['num'] : 5;
         //获取当前模型数据权限 by renl 20150626
         $broMap = Browse::getUserMap($model);
         if ($broMap) {
             if ($map['_string']) {
                 $map['_string'] .= " and " . $broMap;
             } else {
                 $map['_string'] = $broMap;
             }
         }
         $list = $listmodel->where($map)->order('id desc')->limit($val['num'])->select();
         $sublist[$key]["list"] = $list;
         unset($map["_string"]);
     }
     $this->assign("sublist", $sublist);
     $this->display("MisSystemPanelDesingMas:news");
 }
コード例 #3
0
ファイル: subformats.php プロジェクト: GeraldScott/OpenEvSys
 public function l10n($subformat)
 {
     global $conf;
     $locale = $conf['locale'];
     $sql = "SELECT field_label, field_number FROM data_dict WHERE field_name = '{$subformat}'";
     $browse = new Browse();
     $field = $browse->ExecuteQuery($sql)[0];
     $result = $field['field_label'];
     if ($locale != 'en') {
         $field_number = $field['field_number'];
         $sql = "SELECT msgstr FROM data_dict_l10n WHERE msgid = {$field_number} AND locale = '{$locale}'";
         $l10n = $browse->ExecuteQuery($sql);
         if (!is_null($l10n)) {
             $result = $l10n[0]['msgstr'];
         }
     }
     return $result;
 }
コード例 #4
0
 private function loadUserFieldNames()
 {
     $entityFields = Browse::getEntityFields($this->getEntityType());
     foreach ($entityFields as $entityField) {
         $mlt = trim($entityField['is_repeat']) == 'Y' || trim($entityField['is_repeat']) == 'y' ? true : false;
         if ($mlt && $entityField['field_type'] == 'user_select') {
             $this->uf[] = $entityField['field_name'];
         }
     }
     $this->uf = array_unique($this->uf);
 }
コード例 #5
0
ファイル: RecordTask.class.php プロジェクト: vvcumt/zk
 public function saveBrowse($nCoolType)
 {
     try {
         // 		$record = new BrowseRecord();
         $br = new Browse();
         $br->setRecord();
         // 		$result = $record->saveRecord($nCoolType, $br);
         // 		if(!$result){
         // 			Log::write('RecordTask::saverBrowse():saveRecord() failed', 'log');
         // // 			return false;
         // 		}
         // 		$record->close();
         // 		Log::write('RecordTask::saverRequest():saveBrowse()', 'debug');
         $queue = new QueueTask();
         $queue->push('browse', $nCoolType, json_encode($br), 'coolshow_browse_count');
     } catch (Exception $e) {
         Log::write('RecordTask::saveBrowse():QueueTask():push() failed', 'log');
     }
     return true;
 }
コード例 #6
0
ファイル: MtTerms.php プロジェクト: GeraldScott/OpenEvSys
 public function getAllHuriTerms($fieldName)
 {
     if (is_numeric($fieldName)) {
         $listCode = (int) $fieldName;
         $fieldName = $this->getFieldNameforListCode($listCode);
     } else {
         $listCode = $this->getListCodeforMTField($fieldName);
     }
     if ($listCode != null || trim($listCode) != '') {
         //var_dump($listCode);
         $mtTable = "mt_{$listCode}_{$fieldName}";
         $consistancyJoin = "INNER JOIN {$mtTable} ON m.vocab_number = {$mtTable}.vocab_number";
     }
     global $conf;
     $sql = "SELECT m.vocab_number , IFNULL(l.msgstr , english) as 'label',\n                term_order,parent_vocab_number ,term_level ,huri_code\n                FROM mt_vocab m \n                LEFT JOIN mt_vocab_l10n l ON ( l.msgid = m.vocab_number AND l.locale = '{$conf['locale']}' )\n                {$consistancyJoin}\n                WHERE TRIM(list_code)='{$listCode}' AND (visible = 'y' or visible IS NULL) ORDER BY term_order";
     //echo $sql;exit;
     $browse = new Browse();
     $res = $browse->ExecuteQuery($sql);
     //print_r($res);
     return $res;
 }
コード例 #7
0
ファイル: api.class.php プロジェクト: nioc/ampache
 /**
  * videos
  * This returns video objects!
  * @param array $input
  */
 public static function videos($input)
 {
     self::$browse->reset_filters();
     self::$browse->set_type('video');
     self::$browse->set_sort('title', 'ASC');
     $method = $input['exact'] ? 'exact_match' : 'alpha_match';
     Api::set_filter($method, $input['filter']);
     $video_ids = self::$browse->get_objects();
     XML_Data::set_offset($input['offset']);
     XML_Data::set_limit($input['limit']);
     echo XML_Data::videos($video_ids);
 }
コード例 #8
0
ファイル: index.ajax.php プロジェクト: ivan801/ampache
            echo "</div>";
            $results['fslider'] = ob_get_clean();
            ob_start();
            echo "<script language='javascript' type='text/javascript'>";
            echo "\$('#" . $fsname . "').rhinoslider({\n                    showTime: 15000,\n                    effectTime: 2000,\n                    randomOrder: true,\n                    controlsPlayPause: false,\n                    autoPlay: true,\n                    showBullets: 'never',\n                    showControls: 'always',\n                    controlsMousewheel: false,\n            });";
            echo "</script>";
        }
        $results['fslider_script'] = ob_get_clean();
        break;
    case 'songs':
        $label_id = intval($_REQUEST['label']);
        ob_start();
        if ($label_id > 0) {
            $label = new Label($label_id);
            $object_ids = $label->get_songs();
            $browse = new Browse();
            $browse->set_type('song');
            $browse->set_simple_browse(false);
            $browse->save_objects($object_ids);
            $browse->store();
            UI::show_box_top(T_('Songs'), 'info-box');
            require_once AmpConfig::get('prefix') . UI::find_template('show_songs.inc.php');
            UI::show_box_bottom();
        }
        $results['songs'] = ob_get_contents();
        ob_end_clean();
        break;
    default:
        $results['rfc3514'] = '0x1';
        break;
}
コード例 #9
0
ファイル: index.php プロジェクト: axelsimon/ampache
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 */
require_once '../lib/init.php';
if (!Access::check('interface', 100)) {
    UI::access_denied();
    exit;
}
UI::show_header();
switch ($_REQUEST['action']) {
    default:
        // Show Catalogs
        $catalog_ids = Catalog::get_catalogs();
        $browse = new Browse();
        $browse->set_type('catalog');
        $browse->set_static_content(true);
        $browse->save_objects($catalog_ids);
        $browse->show_objects($catalog_ids);
        $browse->store();
        break;
}
UI::show_footer();
コード例 #10
0
ファイル: ajax.server.php プロジェクト: nioc/ampache
 case 'basket':
     $object_type = $_REQUEST['type'];
     $object_id = $_REQUEST['id'];
     if (Core::is_playable_item($object_type)) {
         if (!is_array($object_id)) {
             $object_id = array($object_id);
         }
         foreach ($object_id as $id) {
             $item = new $object_type($id);
             $medias = $item->get_medias();
             $GLOBALS['user']->playlist->add_medias($medias);
         }
     } else {
         switch ($_REQUEST['type']) {
             case 'browse_set':
                 $browse = new Browse($_REQUEST['browse_id']);
                 $objects = $browse->get_saved();
                 foreach ($objects as $object_id) {
                     $GLOBALS['user']->playlist->add_object($object_id, 'song');
                 }
                 break;
             case 'album_random':
                 $data = explode('_', $_REQUEST['type']);
                 $type = $data['0'];
                 foreach ($_REQUEST['id'] as $i) {
                     $object = new $type($i);
                     $songs = $object->get_random_songs();
                     foreach ($songs as $song_id) {
                         $GLOBALS['user']->playlist->add_object($song_id, 'song');
                     }
                 }
コード例 #11
0
ファイル: show_user.inc.php プロジェクト: cheese1/ampache
if (AmpConfig::get('sociable')) {
    ?>
        <div id="following" class="tab_content">
        <?php 
    $following_ids = $client->get_following();
    $browse = new Browse();
    $browse->set_type('user');
    $browse->set_simple_browse(false);
    $browse->show_objects($following_ids);
    $browse->store();
    ?>
        </div>
        <div id="followers" class="tab_content">
        <?php 
    $follower_ids = $client->get_followers();
    $browse = new Browse();
    $browse->set_type('user');
    $browse->set_simple_browse(false);
    $browse->show_objects($follower_ids);
    $browse->store();
    ?>
        </div>
            <div id="timeline" class="tab_content">
                <?php 
    if (Preference::get_by_user($client->id, 'allow_personal_info_recent')) {
        $activities = Useractivity::get_activities($client->id);
        Useractivity::build_cache($activities);
        foreach ($activities as $aid) {
            $activity = new Useractivity($aid);
            $activity->show();
        }
コード例 #12
0
ファイル: browse.ajax.php プロジェクト: nioc/ampache
 * Sub-Ajax page, requires AJAX_INCLUDE
 */
require_once '../lib/init.php';
if (!Core::is_session_started()) {
    session_start();
}
if (!defined('AJAX_INCLUDE')) {
    exit;
}
if (isset($_REQUEST['browse_id'])) {
    $browse_id = $_REQUEST['browse_id'];
} else {
    $browse_id = null;
}
debug_event('browse.ajax.php', 'Called for action: {' . $_REQUEST['action'] . '}', '5');
$browse = new Browse($browse_id);
if (isset($_REQUEST['show_header']) && $_REQUEST['show_header']) {
    $browse->set_show_header($_REQUEST['show_header'] == 'true');
}
$argument = null;
if ($_REQUEST['argument']) {
    $argument = scrub_in($_REQUEST['argument']);
}
$results = array();
switch ($_REQUEST['action']) {
    case 'browse':
        $object_ids = array();
        // Check 'value' with isset because it can null
        //(user type a "start with" word and deletes it)
        if ($_REQUEST['key'] && (isset($_REQUEST['multi_alpha_filter']) or isset($_REQUEST['value']))) {
            // Set any new filters we've just added
コード例 #13
0
ファイル: PublicAction.class.php プロジェクト: tmlsoft/main
 /**
  * @Title: signin 
  * @Description: todo(浏览器版登陆方法)   
  * @author liminggang 
  * @date 2014-8-28 下午4:34:10 
  * @throws
  */
 public function signin()
 {
     //获取产品模块授权培
     $model = D('SerialNumber');
     $system = array();
     $system = $model->CheckFile();
     if (count($system) > 0) {
         //验证序列号文件是否存在,基本校验。
         redirect(U("Public/serialnumber?register=" . $_POST['account']));
     }
     //读取名人录数据
     //$this->getsolidotinfor();
     if ($_POST["login_type"] == "dialog") {
         $this->loginType = "dialog";
     }
     if (empty($_POST['account'])) {
         $this->assign("jumpUrl", __URL__ . '/login/');
     } elseif (empty($_POST['password'])) {
         $this->assign("jumpUrl", __URL__ . '/login/');
     } elseif (C("VERIFICATION_CODE") && empty($_POST['verify'])) {
         if ($this->loginType != 'helperLogin') {
             $this->assign("jumpUrl", __URL__ . '/login/');
             $this->error('验证码必须!');
         }
     } elseif (C("VERIFICATION_CODE") && $_SESSION['verify'] != md5($_POST['verify'])) {
         if ($this->loginType != 'helperLogin') {
             $this->assign("jumpUrl", __URL__ . '/login/');
             $this->error('验证码错误!');
         }
     }
     //获取authinfo信息
     $authInfo = $this->getAuthInfo();
     //使用用户名、密码和状态的方式进行认证
     if (false == $authInfo) {
         $this->assign("jumpUrl", __URL__ . '/login/');
         if ($this->loginType != 'helperLogin') {
             $this->assign("info", "帐号不存在或已禁用!");
             $this->display('login');
         } else {
             return array('status' => 0, 'msg' => "error:帐号不存在或已禁用!");
             exit;
         }
     } else {
         //--------------此部分为验证密码-------------------//
         $checkPwd = $this->checkPwd($authInfo);
         if ($checkPwd) {
             return $checkPwd;
         }
         //-----------以下部分已被分成方法-------------//
         $this->setSession($authInfo);
         //设置session
         $this->setUserInfoCookie($authInfo);
         //设置UserInfo的cookie
         //$this->setBBSCookie($authInfo);//设置BBS的cookie
         $time = time();
         //保存登录信息
         $ip = get_client_ip();
         $data = array();
         $data['last_login_time'] = $time;
         $data['logintime'] = $time;
         $data['isonline'] = 1;
         $data['sessionid'] = session_id();
         $data['id'] = $authInfo['id'];
         $data['login_count'] = array('exp', 'login_count+1');
         $data['login_error_count'] = 0;
         $data['newmsg'] = 1;
         $data['newmsgtype'] = 1;
         $data['last_login_ip'] = $ip;
         if (!$bindacount) {
             $User = M('User');
             $User->save($data);
             $User->commit();
         }
         //新增online信息,类型为新增
         $this->setUserOnline($authInfo, $type = "insert");
         // 缓存访问权限
         RBAC::saveAccessList();
         //写入浏览及权限
         Browse::saveBrowseList();
         if (isset($_SESSION[C('ADMIN_AUTH_KEY')])) {
             $re = $this->check_upgrade(false);
         }
         //如果是从OA客户端登录的,返回真
         if ($this->loginType == 'helperLogin') {
             if ($_REQUEST['fromOA'] == 2) {
                 //$this->success('登录成功!');
                 redirect(U('Index/index'), 0.01, '页面跳转中。。。');
             } else {
                 return array('status' => 1, 'msg' => "success:登录成功!");
                 exit;
             }
         } else {
             if ($this->loginType != 'checkLogin') {
                 redirect(U('Index/index'));
             } else {
                 $this->success('登录成功!');
             }
         }
     }
 }
コード例 #14
0
 protected function searchResult()
 {
     require_once APPROOT . 'mod/analysis/analysisModule.class.php';
     $analysisModule = new analysisModule();
     $dataArray = array();
     //assign post search queries to get
     foreach ($_REQUEST as $key => $element) {
         if ($_REQUEST[$key] != null) {
             $_GET[$key] = $_REQUEST[$key];
         }
     }
     $sqlStatement = $analysisModule->generateSqlforEntity('person', null, $_REQUEST, 'search');
     $entity_type_form_results = generate_formarray('person', 'search_view');
     $entity_type_form_results['person_record_number']['type'] = 'text';
     $field_list = array();
     foreach ($entity_type_form_results as $field_name => $field) {
         $field_list[$field['map']['field']] = $field['label'];
     }
     foreach ($entity_type_form_results as $fieldName => &$field) {
         $field['extra_opts']['help'] = null;
         $field['label'] = null;
         $field['extra_opts']['clari'] = null;
         $field['extra_opts']['value'] = $_GET[$fieldName];
         $field['extra_opts']['required'] = null;
     }
     $entity_fields_html = shn_form_get_html_fields($entity_type_form_results);
     $htmlFields = array();
     //iterate through the search fields, checking input values
     foreach ($entity_type_form_results as $field_name => $x) {
         // Generates the view's Label list
         $htmlFields[$field_name] = $entity_fields_html[$field_name];
     }
     $result_pager = Browse::getExecuteSql($sqlStatement);
     $columnValues = $result_pager->get_page_data();
     $columnValues = set_links_in_recordset($columnValues, 'person');
     set_huriterms_in_record_array($entity_type_form_results, $columnValues);
     //rendering the view
     $columnNames = $field_list;
     $this->htmlFields = $htmlFields;
     if ($columnValues != null && count($columnValues)) {
         $result_pager->render_pages();
         shn_form_get_html_person_search_ctrl($columnNames, $columnValues, $htmlFields, $_GET['mod'], $_GET['act']);
         $result_pager->render_pages();
     } else {
         shnMessageQueue::addInformation(_t('NO_RECORDS_WERE_FOUND_'));
         echo shnMessageQueue::renderMessages();
     }
 }
コード例 #15
0
ファイル: license.php プロジェクト: nioc/ampache
        if (isset($_POST['license_id'])) {
            $license = new License($_POST['license_id']);
            if ($license->id) {
                $license->update($_POST);
            }
            $text = T_('License Updated');
        } else {
            License::create($_POST);
            $text = T_('License Created');
        }
        show_confirmation($text, '', AmpConfig::get('web_path') . '/admin/license.php');
        break;
    case 'show_edit':
        $license = new License($_REQUEST['license_id']);
    case 'show_create':
        require_once AmpConfig::get('prefix') . '/templates/show_edit_license.inc.php';
        break;
    case 'delete':
        License::delete($_REQUEST['license_id']);
        show_confirmation(T_('License Deleted'), '', AmpConfig::get('web_path') . '/admin/license.php');
        break;
    default:
        $browse = new Browse();
        $browse->set_type('license');
        $browse->set_simple_browse(true);
        $license_ids = $browse->get_objects();
        $browse->show_objects($license_ids);
        $browse->store();
        break;
}
UI::show_footer();
コード例 #16
0
 public function act_dashboard()
 {
     global $global, $conf;
     $activeFormats = getActiveFormats();
     $entityFields = Browse::getAllEntityFields();
     $response = array();
     foreach ($activeFormats as $format => $formatTitle) {
         if ($conf['dashboard_format_counts_' . $format] != 'true') {
             continue;
         }
         $count_query = "SELECT COUNT(*) as count FROM {$format} ";
         try {
             $res_count = $global['db']->Execute($count_query);
             foreach ($res_count as $row) {
                 $response["counts"][$format] = array((int) $row["count"], $formatTitle);
             }
         } catch (Exception $e) {
         }
     }
     $timelineType = "day";
     if ($_REQUEST['timelinetype'] == "month") {
         $timelineType = "month";
     } elseif ($_REQUEST['timelinetype'] == "year") {
         $timelineType = "year";
     }
     $this->timelineType = $timelineType;
     if ($timelineType == "month") {
         $dateFormat = '%b %Y';
     } elseif ($timelineType == "year") {
         $dateFormat = '%Y';
     } else {
         $dateFormat = '%d %b %Y';
     }
     $datestart = "";
     $dateend = "";
     if (isset($_REQUEST['daterange'])) {
         $daterange = $_REQUEST['daterange'];
         $daterange = explode(",", $daterange);
         $datestart2 = trim($daterange[0]);
         $dateend2 = trim($daterange[1]);
         $date_format = 'Y-m-d';
         $timestart = strtotime($datestart2);
         $timeend = strtotime($dateend2);
         if ($timestart && $timeend) {
             $datestart = date($date_format, $timestart);
             $dateend = date($date_format, $timeend);
         }
     }
     if ($datestart && $dateend) {
         $this->daterange = $datestart . " , " . $dateend;
     } else {
         $this->daterange = "";
     }
     /*$sql = "SELECT  DATE_FORMAT(m.date_of_entry,'$dateFormat') as val , COUNT(e.event_record_number) AS count
               FROM  event e join management m on m.entity_id=e.event_record_number and m.entity_type='event' ";
       if ($datestart && $dateend) {
           $sql .= " where m.date_of_entry BETWEEN '$datestart' AND '$dateend' ";
       }
       $sql .= "GROUP BY val order by m.date_of_entry ";*/
     $dashboard_date_counts = array();
     if ($conf['dashboard_date_counts']) {
         $dashboard_date_counts = @json_decode($conf['dashboard_date_counts']);
         $dashboard_date_counts = (array) $dashboard_date_counts;
     }
     $response["timeline"] = array();
     foreach ($entityFields as $record) {
         $entity = $record['entity'];
         $field = $record['field_name'];
         $selVal = $entity . "|||" . $field;
         if (in_array($selVal, $dashboard_date_counts)) {
             $primary_key = get_primary_key($entity);
             if (in_array($field, array('date_received', 'date_of_entry', 'date_updated'))) {
                 $sql = "SELECT  DATE_FORMAT(m.{$field},'{$dateFormat}') as val , COUNT(e.{$primary_key}) AS count\n                      FROM  {$entity} e join management m on m.entity_id=e.{$primary_key} and m.entity_type='{$entity}' ";
                 if ($datestart && $dateend) {
                     $sql .= " where m.{$field} BETWEEN '{$datestart}' AND '{$dateend}' ";
                 }
                 $sql .= "GROUP BY val order by m.{$field} ";
             } else {
                 $sql = "SELECT  DATE_FORMAT(e.{$field} ,'{$dateFormat}') as val , COUNT(e.{$primary_key}) AS count\n                      FROM  {$entity} e  ";
                 if ($datestart && $dateend) {
                     $sql .= " where e.{$field}  BETWEEN '{$datestart}' AND '{$dateend}' ";
                 }
                 $sql .= "GROUP BY val order by e.{$field}  ";
             }
             $response["timeline"][$selVal]['entity'] = $entity;
             $response["timeline"][$selVal]['entity_label'] = $activeFormats[$entity];
             $response["timeline"][$selVal]['field_name'] = $field;
             $response["timeline"][$selVal]['field_label'] = $record['field_label'];
             try {
                 $res_count = $global['db']->Execute($sql);
                 foreach ($res_count as $row) {
                     $response["timeline"][$selVal]['data'][0] = array(ucfirst($timelineType), "Count");
                     if (!$row["val"] && !(int) $row["count"]) {
                         continue;
                     }
                     if (!$row["val"]) {
                         $row["val"] = "Undefined";
                     }
                     $response["timeline"][$selVal]['data'][] = array($row["val"], (int) $row["count"]);
                 }
             } catch (Exception $e) {
             }
         }
     }
     $barcharts = array();
     $dashboard_select_counts = array();
     if ($conf['dashboard_select_counts']) {
         $dashboard_select_counts = @json_decode($conf['dashboard_select_counts']);
         $dashboard_select_counts = (array) $dashboard_select_counts;
     }
     foreach ($entityFields as $record) {
         $entity = $record['entity'];
         $selVal = $entity . "|||" . $record['field_name'];
         if (in_array($selVal, $dashboard_select_counts)) {
             $barcharts[] = array("entity" => $entity, "field" => $record['field_name']);
         }
     }
     require_once APPROOT . 'mod/analysis/searchSql.php';
     $searchSql = new SearchResultGenerator();
     foreach ($barcharts as $key => $barchart) {
         $selEntity = $selEntityOriginal = $barchart["entity"];
         $field = $barchart["field"];
         $entityForm = $searchSql->getEntityArray($selEntityOriginal);
         if (!isset($entityForm[$field])) {
             continue;
         }
         $fieldArray = $entityForm[$field];
         $fieldType = $fieldArray["type"];
         $recField = get_primary_key($selEntityOriginal);
         $sqlArray['result'] = "select * from {$selEntityOriginal} ";
         $sqlchart = "";
         if ($fieldArray['map']['mlt']) {
             $mltTable = 'mlt_' . $searchSql->tableOfEntity($fieldArray['map']['entity']) . '_' . $fieldArray['map']['field'];
             $sqlchart = "SELECT IFNULL(l.msgstr , english) as val, COUNT(t.record_number) AS count\n                            FROM ({$sqlArray['result']}) d LEFT JOIN {$mltTable} t  on  t.record_number=d.{$recField} left join\n                            mt_vocab m on m.vocab_number=t.vocab_number\n                            LEFT JOIN mt_vocab_l10n l ON ( l.msgid = m.vocab_number AND l.locale = '{$conf['locale']}' )  GROUP BY t.vocab_number\n                            ";
         } elseif (is_management_field($fieldArray)) {
             $f = $fieldArray['map']['field'];
             $sqlchart = "SELECT IFNULL(l.msgstr , english) as val, COUNT(d.{$recField}) AS count\n                            FROM ({$sqlArray['result']}) d LEFT JOIN management t  on t.entity_id=d.{$recField} and t.entity_type='{$selEntity}' \n                            left join  mt_vocab m on m.vocab_number=t.{$fieldArray['map']['field']}\n                            LEFT JOIN mt_vocab_l10n l ON ( l.msgid = m.vocab_number AND l.locale = '{$conf['locale']}' )  GROUP BY {$f}\n                            ";
         } else {
             $f = $fieldArray['map']['field'];
             if ($fieldType == "mt_select" || $fieldType == "mt_tree") {
                 $sqlchart = "SELECT IFNULL(l.msgstr , english)  as val, COUNT({$recField}) AS count\n                            FROM ({$sqlArray['result']}) d left join  mt_vocab m on m.vocab_number=d.{$f}\n                            LEFT JOIN mt_vocab_l10n l ON ( l.msgid = m.vocab_number AND l.locale = '{$conf['locale']}' )  GROUP BY {$f}";
             } else {
                 $sqlchart = "SELECT d.{$f} as val, COUNT({$recField}) AS count\n                            FROM ({$sqlArray['result']}) d   GROUP BY {$f}";
             }
         }
         if ($sqlchart) {
             try {
                 $res = $global['db']->Execute($sqlchart);
                 $chart = array();
                 $chart["type"] = "barchart";
                 $chart["id"] = "barchart" . $key;
                 $chart["title"] = $fieldArray["label"];
                 $chart2 = $chart;
                 $total = 0;
                 foreach ($res as $val) {
                     $chart["data"][0][0] = $chart["title"];
                     $chart["data"][1][0] = "";
                     $vall = _t("Undefined");
                     if ($val[0]) {
                         if ($val[0] == "y") {
                             $vall = _t('YES');
                         } elseif ($val[0] == "n") {
                             $vall = _t('NO');
                         } else {
                             $vall = $val[0];
                         }
                     } elseif (!(int) $val[1]) {
                         continue;
                     }
                     $chart["data"][0][] = $vall;
                     $chart["data"][1][] = (int) $val[1];
                     $chart2["data"][0] = array($chart["title"], _t("COUNT"));
                     $chart2["data"][] = array($vall, (int) $val[1]);
                     $total += (int) $val[1];
                 }
                 $chart2["total"] = $total;
                 $response["barchart"][] = $chart2;
             } catch (Exception $e) {
                 $response->error = "error";
                 //$e->getMessage();
             }
         }
     }
     $entities = array_keys($activeFormats);
     foreach ($entities as $entity) {
         $recField = get_primary_key($entity);
         $count_query = "SELECT COUNT(m.entity_id) AS count\n                FROM  {$entity} e join management m on m.entity_id=e.{$recField} and m.entity_type='{$entity}'\n                    where m.date_of_entry BETWEEN CURDATE() - INTERVAL 30 DAY AND CURDATE()\n                    GROUP BY m.entity_type  ";
         try {
             $res_count = $global['db']->Execute($count_query);
             foreach ($res_count as $row) {
                 $response["counts30"][$entity] = array((int) $row["count"], $activeFormats[$entity]);
             }
         } catch (Exception $e) {
         }
     }
     $sql = "SELECT al.username as val,COUNT(al.`action`) AS count\n                FROM  audit_log al where al.action='create'\n                    GROUP BY al.username order by `count` desc ";
     try {
         $res_count = $global['db']->Execute($sql);
         foreach ($res_count as $row) {
             $response["activeusers"][] = array($row["val"], (int) $row["count"]);
         }
     } catch (Exception $e) {
     }
     $sql = "SELECT al.username as val,COUNT(al.`action`) AS count\n                FROM  audit_log al where al.action='update'\n                    GROUP BY al.username order by `count` desc ";
     try {
         $res_count = $global['db']->Execute($sql);
         foreach ($res_count as $row) {
             $response["editusers"][] = array($row["val"], (int) $row["count"]);
         }
     } catch (Exception $e) {
     }
     $sql = "SELECT al.username as username,entity,record_number\n                FROM  audit_log al where al.action='delete'\n                order by `timestamp` desc limit 10  ";
     try {
         $res_count = $global['db']->Execute($sql);
         foreach ($res_count as $row) {
             $response["deleteusers"][] = array($row["entity"], $row["record_number"], $row["username"]);
         }
     } catch (Exception $e) {
     }
     // var_dump($response);exit;
     $this->response = $response;
 }
コード例 #17
0
 public function delete($ids)
 {
     if (!is_array($ids)) {
         $ids = array($ids);
     }
     $browse = new Browse();
     $sql = "DELETE FROM {$this->subformat_name} WHERE `vocab_number` in ('" . implode("', '", $ids) . "')";
     $browse->ExecuteNonQuery($sql);
 }
コード例 #18
0
ファイル: import.php プロジェクト: GeraldScott/OpenEvSys
function get_data_array()
{
    global $dataFile, $dataCols, $fields, $lists, $docsCount, $biosCount;
    if (($handle = fopen($dataFile, "r")) === FALSE) {
        return array();
    }
    $results = array();
    $j = 0;
    while (($cols = fgetcsv($handle, 0, "\t")) !== FALSE) {
        $glData = array();
        $row = array();
        if ($cols && $cols[1]) {
            //var_dump($cols);exit;
            foreach ($cols as $key => $val) {
                $val = trim($val, '"');
                $val = trim($val);
                $row[$key] = $val;
                $entityField = $dataCols[$key];
                if ($entityField) {
                    $ent = $entityField["ent"];
                    $list_code = $entityField['list_code'];
                    $type = $entityField['field_type'];
                    $mlt = trim($entityField['is_repeat']) == 'Y' || trim($entityField['is_repeat']) == 'y' ? true : false;
                    if ($list_code == 39) {
                        if ($val == "M") {
                            $val = "Hombre";
                        } elseif ($val == "F") {
                            $val = "Mujer";
                        }
                    }
                    if ($list_code && !$lists[$list_code]) {
                        $options = array();
                        $data_array = MtFieldWrapper::getMTList($list_code);
                        $size = count($data_array);
                        for ($i = 0; $i < $size; $i++) {
                            $options[$data_array[$i]['vocab_number']] = strtolower($data_array[$i]['label']);
                        }
                        $lists[$list_code] = $options;
                    }
                    if ($list_code) {
                        if ($mlt) {
                            $val2 = explode(";", $val);
                            $val = array();
                            foreach ($val2 as $v) {
                                $v = trim($v);
                                $vocab_number = array_search(strtolower($v), $lists[$list_code]);
                                if ($vocab_number) {
                                    $val[] = $vocab_number;
                                }
                            }
                        } else {
                            $vocab_number = array_search(strtolower($val), $lists[$list_code]);
                            if ($vocab_number) {
                                $val = $vocab_number;
                            } else {
                                $val = null;
                            }
                        }
                    }
                    if ($type == "date") {
                        if ($val) {
                            $d = date_create_from_format("m/d/Y", $val);
                            if ($d) {
                                $val = date_format($d, 'Y-m-d');
                            } else {
                                $val = null;
                            }
                        } else {
                            $val = null;
                        }
                    } elseif ($type == "location") {
                        $val2 = explode(",", $val);
                        //$row[$entityField['field_name'] . "_latitude"] = -floatval($val2[0]);
                        //$row[$entityField['field_name'] . "_longitude"] = -floatval($val2[1]);
                        $glData[$ent][$entityField['field_name'] . "_latitude"] = -floatval($val2[0]);
                        $glData[$ent][$entityField['field_name'] . "_longitude"] = -floatval($val2[1]);
                        $val = null;
                    } elseif ($type == "radio") {
                        if ($val == "NO" || $val == "no") {
                            $val = "n";
                        } elseif ($val == "SÍ" || $val == "sí") {
                            $val = "y";
                        } else {
                            $val = null;
                        }
                    }
                    if (!is_null($val)) {
                        //$row[$entityField['field_name']] = $val;
                        $glData[$ent][$entityField['field_name']] = $val;
                    }
                }
            }
            if (!$glData['act']['ubicacto']) {
                $v = $row[25];
                $vocab_number = array_search(strtolower($v), $lists[71]);
                if ($vocab_number) {
                    $glData['act']['ubicacto'] = $vocab_number;
                }
            }
            if (!$glData['act']['ubicacto']) {
                $v = $row[24];
                $vocab_number = array_search(strtolower($v), $lists[71]);
                if ($vocab_number) {
                    $glData['act']['ubicacto'] = $vocab_number;
                }
            }
            $browse = new Browse();
            $rows = $browse->ExecuteQuery("select event_record_number as id from event where event_title='" . $glData['event']['event_title'] . "'");
            if ($rows && $rows[0]['id']) {
                $event = new Event();
                $event->LoadFromRecordNumber($rows[0]['id']);
            } else {
                $form = event_form('new');
                $event = new Event();
                $event->event_record_number = shn_create_uuid('event');
                form_objects($form, $event, $glData['event']);
                $event->SaveAll();
            }
            $browse = new Browse();
            $person = null;
            if ($glData['person']['person_name'] != "NN") {
                $rows = $browse->ExecuteQuery("select person_record_number as id from person where person_name='" . $glData['person']['person_name'] . "' \n\t\t\t\tand other_names='" . $glData['person']['other_names'] . "' ");
                if ($rows && $rows[0]['id']) {
                    $person = new Person();
                    $person->LoadFromRecordNumber($rows[0]['id']);
                }
            }
            if (!$person) {
                $person_form = person_form('new');
                $person = new Person();
                form_objects($person_form, $person, $glData['person']);
                $person->deceased = $person->deceased == 'on' ? 'y' : 'n';
                if (isset($person->number_of_persons_in_group) && !$person->number_of_persons_in_group) {
                    $person->number_of_persons_in_group = Null;
                }
                if (isset($person->dependants) && !$person->dependants) {
                    $person->dependants = Null;
                }
                $person->SaveAll();
            }
            $victim = $person;
            $act_form = act_form('new');
            $act = new Act();
            $act->act_record_number = shn_create_uuid('act');
            $glData['act']['victim'] = $victim->person_record_number;
            form_objects($act_form, $act, $glData['act']);
            $act->event = $event->event_record_number;
            $act->SaveAll();
            if ($glData['perpetrator']['person_name']) {
                $browse = new Browse();
                $rows = $browse->ExecuteQuery("select person_record_number as id from person where person_name='" . $glData['perpetrator']['person_name'] . "' ");
                if ($rows && $rows[0]['id']) {
                    $person = new Person();
                    $person->LoadFromRecordNumber($rows[0]['id']);
                } else {
                    $person_form = person_form('new');
                    $person = new Person();
                    form_objects($person_form, $person, $glData['perpetrator']);
                    $person->deceased = $person->deceased == 'on' ? 'y' : 'n';
                    if (isset($person->number_of_persons_in_group) && !$person->number_of_persons_in_group) {
                        $person->number_of_persons_in_group = Null;
                    }
                    if (isset($person->dependants) && !$person->dependants) {
                        $person->dependants = Null;
                    }
                    $person->SaveAll();
                }
                $perpetrator = $person;
                $inv = new Involvement();
                $inv->involvement_record_number = shn_create_uuid('inv');
                $inv->degree_of_involvement = "54010101001921";
                //placeholder
                $inv->event = $event->event_record_number;
                $inv->act = $act->act_record_number;
                $inv->perpetrator = $perpetrator->person_record_number;
                $inv->SaveAll();
            }
            $supporting_documents = array();
            if (trim($row[9])) {
                $document_form = document_form('new');
                unset($document_form['doc_id']);
                $supporting_docs = new SupportingDocs();
                $supporting_docs_meta = new SupportingDocsMeta();
                $type = null;
                $doc_uuid = shn_create_uuid('doc');
                $supporting_docs->doc_id = $doc_uuid;
                $supporting_docs_meta->doc_id = $doc_uuid;
                $supporting_docs->uri = '';
                form_objects($document_form, $supporting_docs, array('title' => $row[9]));
                form_objects($document_form, $supporting_docs_meta, array('title' => $row[9]));
                $supporting_docs_meta->format = $type;
                $supporting_docs->Save();
                $supporting_docs_meta->Save();
                $supporting_documents[] = $doc_uuid;
            }
            for ($j = 1; $j <= $docsCount; $j++) {
                if ($glData["supporting_docs_meta" . $j]) {
                    if (!$glData["supporting_docs_meta" . $j]['title']) {
                        continue;
                    }
                    $document_form = document_form('new');
                    unset($document_form['doc_id']);
                    $supporting_docs = new SupportingDocs();
                    $supporting_docs_meta = new SupportingDocsMeta();
                    $type = null;
                    $doc_uuid = shn_create_uuid('doc');
                    $supporting_docs->doc_id = $doc_uuid;
                    $supporting_docs_meta->doc_id = $doc_uuid;
                    $supporting_docs->uri = '';
                    form_objects($document_form, $supporting_docs, $glData["supporting_docs_meta" . $j]);
                    form_objects($document_form, $supporting_docs_meta, $glData["supporting_docs_meta" . $j]);
                    $supporting_docs_meta->format = $type;
                    $supporting_docs->Save();
                    $supporting_docs_meta->SaveAll();
                    $supporting_documents[] = $doc_uuid;
                }
            }
            if ($supporting_documents) {
                $act->supporting_documents = $supporting_documents;
                $act->SaveDocs();
            }
            $bio_details = array();
            for ($j = 1; $j <= $biosCount; $j++) {
                if ($glData["bio_details" . $j] && $glData["bio_details" . $j]["type_of_relationship"]) {
                    $browse = new Browse();
                    $rows = $browse->ExecuteQuery("select person_record_number as id from person where person_name='" . $glData["bio_details" . $j]['person_name'] . "' \n\t\t\t\t\tand other_names='" . $glData['bio_details']['other_names'] . "' ");
                    if ($rows && $rows[0]['id']) {
                        $person = new Person();
                        $person->LoadFromRecordNumber($rows[0]['id']);
                    } else {
                        $person_form = person_form('new');
                        $person = new Person();
                        form_objects($person_form, $person, $glData["bio_details" . $j]);
                        $person->deceased = $person->deceased == 'on' ? 'y' : 'n';
                        if (isset($person->number_of_persons_in_group) && !$person->number_of_persons_in_group) {
                            $person->number_of_persons_in_group = Null;
                        }
                        if (isset($person->dependants) && !$person->dependants) {
                            $person->dependants = Null;
                        }
                        $person->SaveAll();
                    }
                    if ($glData["bio_details" . $j]["phone"] || $glData["bio_details" . $j]["email"]) {
                        $address = new Address();
                        $address_form = address_form('new');
                        form_objects($address_form, $address, $glData["bio_details" . $j]);
                        $address->person = $person->person_record_number;
                        $address->Save();
                    }
                    $biography_form = biographic_form('new');
                    $biography = new BiographicDetail();
                    //$biography->LoadfromRecordNumber();
                    $biography->biographic_details_record_number = shn_create_uuid('biography');
                    $glData["bio_details" . $j]['person_id'] = $person->person_record_number;
                    form_objects($biography_form, $biography, $glData["bio_details" . $j]);
                    $biography->person = $victim->person_record_number;
                    $biography->related_person = $person->person_record_number;
                    if ($biography->related_person == '') {
                        $biography->related_person = null;
                    }
                    $biography->SaveAll();
                }
            }
        }
        $results[] = $row;
        $j++;
    }
    return $results;
}
コード例 #19
0
<?php

/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
/**
 *
 * LICENSE: GNU General Public License, version 2 (GPLv2)
 * Copyright 2001 - 2015 Ampache.org
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License v2
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 */
$object_ids = Wanted::get_wanted_list();
$browse = new Browse();
$browse->set_type('wanted');
$browse->set_static_content(true);
$browse->save_objects($object_ids);
$browse->show_objects($object_ids);
$browse->store();
コード例 #20
0
', '<?php 
        echo T_('Album edit');
        ?>
', '')">
                <?php 
        echo UI::get_icon('edit', T_('Edit'));
        ?>
            </a>
        <?php 
    }
    ?>
    </div>
    <div id='reordered_list_<?php 
    echo $album_id;
    ?>
'>
    <?php 
    $browse = new Browse();
    $browse->set_show_header(false);
    $browse->set_type('song');
    $browse->set_simple_browse(true);
    $browse->set_filter('album', $album_id);
    $browse->set_sort('track', 'ASC');
    $browse->get_objects();
    $browse->show_objects(null, true);
    // true argument is set to show the reorder column
    $browse->store();
    ?>
    </div><br />
<?php 
}
コード例 #21
0
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
if (!Core::is_session_started()) {
    session_start();
}
?>

<?php 
$allowed_filters = Browse::get_allowed_filters($browse->get_type());
?>
<li>
    <h4><?php 
echo T_('Filters');
?>
</h4>
    <div class="sb3">
    <?php 
if (in_array('starts_with', $allowed_filters)) {
    ?>
        <form id="multi_alpha_filter_form" action="javascript:void(0);">
            <label id="multi_alpha_filterLabel" for="multi_alpha_filter"><?php 
    echo T_('Starts With');
    ?>
</label>
コード例 #22
0
ファイル: playlist.ajax.php プロジェクト: cheese1/ampache
    exit;
}
$results = array();
switch ($_REQUEST['action']) {
    case 'delete_track':
        // Create the object and remove the track
        $playlist = new Playlist($_REQUEST['playlist_id']);
        $playlist->format();
        if ($playlist->has_access()) {
            $playlist->delete_track($_REQUEST['track_id']);
            // This could have performance issues
            $playlist->regenerate_track_numbers();
        }
        $object_ids = $playlist->get_items();
        ob_start();
        $browse = new Browse();
        $browse->set_type('playlist_song');
        $browse->add_supplemental_object('playlist', $playlist->id);
        $browse->save_objects($object_ids);
        $browse->show_objects($object_ids);
        $browse->store();
        $results[$browse->get_content_div()] = ob_get_clean();
        break;
    case 'append_item':
        // Only song item are supported with playlists
        debug_event('playlist', 'Appending items to playlist {' . $_REQUEST['playlist_id'] . '}...', '5');
        if (!isset($_REQUEST['playlist_id']) || empty($_REQUEST['playlist_id'])) {
            if (!Access::check('interface', '25')) {
                debug_event('DENIED', 'Error:' . $GLOBALS['user']->username . ' does not have user access, unable to create playlist', '1');
                break;
            }
コード例 #23
0
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 */
$sql = Stats::get_recent_sql('album', $user_id);
$browse = new Browse();
$browse->set_type('album', $sql);
$browse->set_simple_browse(true);
$browse->show_objects();
$browse->store();
$sql = Stats::get_recent_sql('artist', $user_id);
$browse = new Browse();
$browse->set_type('artist', $sql);
$browse->set_simple_browse(true);
$browse->show_objects();
$browse->store();
$sql = Stats::get_recent_sql('song', $user_id);
$browse = new Browse();
$browse->set_type('song', $sql);
$browse->set_simple_browse(true);
$browse->show_objects();
$browse->store();
if (AmpConfig::get('allow_video')) {
    $sql = Stats::get_recent_sql('video', $user_id);
    $browse = new Browse();
    $browse->set_type('video', $sql);
    $browse->set_simple_browse(true);
    $browse->show_objects();
    $browse->store();
}
コード例 #24
0
ファイル: show_playlist.inc.php プロジェクト: cheese1/ampache
');">
                <?php 
    echo UI::get_icon('delete');
    ?>
                &nbsp;&nbsp;<?php 
    echo T_('Delete');
    ?>
            </a>
        </li>
    <?php 
}
?>
    </ul>
</div>
<?php 
UI::show_box_bottom();
?>
<div id='reordered_list_<?php 
echo $playlist->id;
?>
'>
<?php 
$browse = new Browse();
$browse->set_type('playlist_song');
$browse->add_supplemental_object('playlist', $playlist->id);
$browse->set_static_content(true);
$browse->show_objects($object_ids, true);
$browse->store();
?>
</div>
コード例 #25
0
ファイル: show_artist.inc.php プロジェクト: axelsimon/ampache
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License v2
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 */
$web_path = AmpConfig::get('web_path');
$browse = new Browse();
$browse->set_type($object_type);
UI::show_box_top($artist->f_name, 'info-box');
if (AmpConfig::get('lastfm_api_key')) {
    echo Ajax::observe('window', 'load', Ajax::action('?page=index&action=artist_info&artist=' . $artist->id, 'artist_info'));
    ?>
    <div class="item_right_info">
        <div class="external_links">
            <a href="http://www.google.com/search?q=%22<?php 
    echo rawurlencode($artist->f_name);
    ?>
%22" target="_blank"><?php 
    echo UI::get_icon('google', T_('Search on Google ...'));
    ?>
</a>
            <a href="http://en.wikipedia.org/wiki/Special:Search?search=%22<?php 
コード例 #26
0
 /**
  * act_audit 
  * 
  * @access public
  * @return void
  */
 public function act_audit()
 {
     $this->res = $supporting_docs_meta;
     if (isset($_GET['doc_id'])) {
         $supporting_docs_meta = new SupportingDocsMeta();
         $supporting_docs_meta->LoadfromRecordNumber($_GET['doc_id']);
         $supporting_docs_meta->LoadRelationships();
         $this->supporting_docs_meta = $supporting_docs_meta;
         $logs = Browse::getAuditLogForDocument($_GET['doc_id']);
         $this->logs = $logs;
     }
 }
コード例 #27
0
require_once '../lib/init.php';
debug_event('refresh_reordered.server.php', 'Called for action: {' . $_REQUEST['action'] . '}', '5');
/* Switch on the action passed in */
switch ($_REQUEST['action']) {
    case 'refresh_playlist_medias':
        $playlist = new Playlist($_REQUEST['id']);
        $playlist->format();
        $object_ids = $playlist->get_items();
        $browse = new Browse();
        $browse->set_type('playlist_media');
        $browse->add_supplemental_object('playlist', $playlist->id);
        $browse->set_static_content(true);
        $browse->show_objects($object_ids);
        $browse->store();
        break;
    case 'refresh_album_songs':
        $browse = new Browse();
        $browse->set_show_header(true);
        $browse->set_type('song');
        $browse->set_simple_browse(true);
        $browse->set_filter('album', $_REQUEST['id']);
        $browse->set_sort('track', 'ASC');
        $browse->get_objects();
        echo "<div id='browse_content_song' class='browse_content'>";
        $browse->show_objects(null, true);
        // true argument is set to show the reorder column
        $browse->store();
        echo "</div>";
        break;
}
// switch on the action
コード例 #28
0
ファイル: democratic.ajax.php プロジェクト: cheese1/ampache
        $_SESSION['iframe']['target'] = AmpConfig::get('web_path') . '/stream.php?action=democratic&democratic_id=' . scrub_out($_REQUEST['democratic_id']);
        $results['rfc3514'] = '<script type="text/javascript">' . Core::get_reloadutil() . '("' . $_SESSION['iframe']['target'] . '")</script>';
        break;
    case 'clear_playlist':
        if (!Access::check('interface', '100')) {
            echo xoutput_from_array(array('rfc3514' => '0x1'));
            exit;
        }
        $democratic = new Democratic($_REQUEST['democratic_id']);
        $democratic->set_parent();
        $democratic->clear();
        $show_browse = true;
        break;
    default:
        $results['rfc3514'] = '0x1';
        break;
}
// switch on action;
if ($show_browse) {
    ob_start();
    $object_ids = $democratic->get_items();
    $browse = new Browse();
    $browse->set_type('democratic');
    $browse->set_static_content(false);
    $browse->show_objects($object_ids);
    $browse->store();
    $results[$browse->get_content_div()] = ob_get_contents();
    ob_end_clean();
}
// We always do this
echo xoutput_from_array($results);
コード例 #29
0
ファイル: random.ajax.php プロジェクト: cheese1/ampache
        $items = $playlist->get_items();
        foreach ($items as $item) {
            $GLOBALS['user']->playlist->add_object($item['object_id'], $item['object_type']);
        }
        $results['rightbar'] = UI::ajax_include('rightbar.inc.php');
        break;
    case 'advanced_random':
        $object_ids = Random::advanced('song', $_POST);
        // First add them to the active playlist
        if (is_array($object_ids)) {
            foreach ($object_ids as $object_id) {
                $GLOBALS['user']->playlist->add_object($object_id, 'song');
            }
        }
        $results['rightbar'] = UI::ajax_include('rightbar.inc.php');
        // Now setup the browse and show them below!
        $browse = new Browse();
        $browse->set_type('song');
        $browse->save_objects($object_ids);
        ob_start();
        $browse->show_objects();
        $results['browse'] = ob_get_contents();
        ob_end_clean();
        break;
    default:
        $results['rfc3514'] = '0x1';
        break;
}
// switch on action;
// We always do this
echo xoutput_from_array($results);
コード例 #30
0
    <li>
        <?php 
echo T_('Wanted actions');
?>
:
        <div id="wanted_action_<?php 
echo $walbum->mbid;
?>
">
        <?php 
$walbum->show_action_buttons();
?>
        </div>
    </li>
</ul>
</div>
<?php 
UI::show_box_bottom();
?>
<div id="additional_information">
&nbsp;
</div>
<div>
<?php 
$browse = new Browse();
$browse->set_type('song_preview');
$browse->set_static_content(true);
$browse->show_objects($walbum->songs);
?>
</div>