public function groups()
 {
     $aKeyword = $this->parseSearchKey('keyword');
     $aPage = I('get.page', 1, 'intval');
     $r = 20;
     $aOrder = I('get.order', 'create_time', 'text');
     $aReverse = I('get.reverse', 'desc', 'text');
     $aCate = I('get.cate', 0, 'intval');
     $aUid = I('get.uid', 0, 'intval');
     if ($aOrder == 'activity') {
         $this->assign('order', '按活跃度排序');
     } elseif ($aOrder == 'member') {
         //todo 根据成员数排序
         $Model = new \Think\Model();
         // 实例化一个model对象 没有对应任何数据表
         $count = $Model->query("SELECT group_id,count(group_id) as count from opensns_group_member group by group_id order by count desc");
         $ids = getSubByKey($count, 'group_id');
         $ids = implode(',', $ids);
         $aOrder = "find_in_set( id ,'" . $ids . "') ";
         $this->assign('order', '按成员数排序');
     } else {
         $aOrder = 'create_time';
         $this->assign('order', '按最新创建排序');
     }
     if (!empty($aCate)) {
         $gid = D('GroupType')->where('pid=' . $aCate)->field('id')->select();
         $gids = getSubByKey($gid, 'id');
         $gids[] = $aCate;
         $param['where']['type_id'] = array('in', $gids);
         $this->assign('name', get_type_name($aCate));
         $this->assign('group_cate', $aCate);
         $this->assign('keyword', array(0 => 'cate', 1 => $aCate));
         $this->setTitle('{$name}');
     }
     if (!empty($aKeyword)) {
         $param['where']['title'] = array('like', '%' . $aKeyword . '%');
         $this->assign('name', $aKeyword);
         $this->assign('keyword', array(0 => 'keywords', 1 => $aKeyword));
     }
     if ($aUid != 0) {
         $param['where']['uid'] = $aUid;
         $this->assign('name', get_nickname($aUid) . '的群组');
         $this->assign('keyword', array(0 => 'uid', 1 => $aUid));
     }
     $param['where']['status'] = 1;
     $param['page'] = $aPage;
     $param['count'] = $r;
     $param['order'] = $aOrder . ' ' . $aReverse;
     $param['field'] = 'id';
     $group_list = D('Group/Group')->getList($param);
     //获取总数
     $totalCount = D('Group/Group')->where($param['where'])->count();
     $this->assign('totalCount', $totalCount);
     $this->assign('r', $r);
     $this->assign('group_list', $group_list);
     $this->assignGroupTypes();
     $this->setTitle('群组首页');
     $this->assign('current', 'groups');
     $this->display();
 }
    } else {
        foreach ($__LIST__ as $key => $deal) {
            ++$i;
            $mod = $i % 2;
            ?>
<tr class="row" ><td><input type="checkbox" name="key" class="key" value="<?php 
            echo $deal["id"];
            ?>
"></td><td><?php 
            echo $deal["id"];
            ?>
</td><td><?php 
            echo edit_new($deal["name"], $deal['id']);
            ?>
</td><td><?php 
            echo get_type_name($deal["type"]);
            ?>
</td><td><?php 
            echo is_ips_bill_no_admin($deal["ips_bill_no"]);
            ?>
</td><td><?php 
            echo get_deal_user($deal["user_id"]);
            ?>
</td><td><?php 
            echo format_price($deal["limit_price"]);
            ?>
</td><td><?php 
            echo $deal["deal_days"];
            ?>
</td><td><?php 
            echo to_date($deal["create_time"]);
Exemple #3
0
            ?>
</td>
<td class="colfollow"><?php 
            echo htmlspecialchars($row['name']);
            ?>
</td>
<td class="colfollow"><?php 
            echo get_position_name($row['position']);
            ?>
</td>
<td class="colfollow"><?php 
            echo $row['displayorder'];
            ?>
</td>
<td class="colfollow"><?php 
            echo get_type_name($row['type']);
            ?>
</td>
<td class="colfollow"><?php 
            echo $row['starttime'] ? $row['starttime'] : $lang_admanage['text_unlimited'];
            ?>
</td>
<td class="colfollow"><?php 
            echo $row['endtime'] ? $row['endtime'] : $lang_admanage['text_unlimited'];
            ?>
</td>
<td class="colfollow"><?php 
            echo $clickcount;
            ?>
</td>
<td class="colfollow"><a href="javascript:confirm_delete('<?php 
            ++$i;
            ?>
<tr>
              <td  width="92" align='center'><?php 
            echo $vo["id"];
            ?>
</td>
              <td><input type="text"  name="sort[]"  size="2" class="input-sort" value="<?php 
            echo $vo["sort"];
            ?>
" />&nbsp;<?php 
            echo $vo["title"];
            ?>
</td>
              <td><?php 
            echo get_type_name($vo["class"]);
            ?>
</td>
              <td align="center"><?php 
            if ($vo['status']) {
                ?>
开启<?php 
            } else {
                ?>
关闭<?php 
            }
            ?>
</td>
              <td align="center"><a href="/admin.php/Type/edit/id/<?php 
            echo $vo["id"];
            ?>
// Use the first account - Connection objects are not actually account-specific
// so the account ID doesn't matter
$user = new AdUser('me');
$accounts = $user->getAdAccounts([AdAccountFields::ID]);
$account = $accounts[0];
$connection_objects = $account->getConnectionObjects([ConnectionObjectFields::ID, ConnectionObjectFields::NAME, ConnectionObjectFields::OBJECT_STORE_URLS, ConnectionObjectFields::TYPE, ConnectionObjectFields::URL]);
// Group the connection objects based on type
$groups = [];
foreach ($connection_objects as $object) {
    if (!isset($groups[$object->type])) {
        $groups[$object->type] = [];
    }
    $groups[$object->type][] = $object;
}
foreach ($groups as $type => $type_objects) {
    $type_name = get_type_name($type);
    echo "\n", $type_name, "\n";
    echo str_repeat('=', strlen($type_name)), "\n";
    foreach ($type_objects as $object) {
        render_object($object);
    }
}
function get_type_name($type)
{
    switch ($type) {
        case ConnectionObjectTypes::PAGE:
            return 'Page';
        case ConnectionObjectTypes::APPLICATION:
            return 'Application';
        case ConnectionObjectTypes::EVENT:
            return 'Event';
function get_group_type($group_id)
{
    $group = D('Group')->getGroup($group_id);
    return get_type_name($group['type_id']);
}
/**
 * Display profile fields in a table.
 * @param $res		Recordset of profile fields.
 */
function display_fields($res)
{
    global $modified;
    global $mandatory;
    echo "<table width=\"100%\" border=\"1\" class=\"profile_fields\">\n";
    echo '
		<tr style="font-weight:bold">
			<td>name</td>
			<td>caption</td>
			<td>type</td>
			<td colspan="2">order</td>
			<td>del</td>
			<td>edit</td>
		</tr>
		';
    $odd_cnt = 0;
    $cnt = 0;
    $total_rows = mysql_num_rows($res);
    // Collect all fields and determine which of them are group
    while ($row = mysql_fetch_array($res)) {
        $rows[$cnt] = $row;
        $fname = get_field_name($row);
        $rows[$cnt]['db_name'] = $fname;
        $field_groups[$fname]['count']++;
        $cnt++;
    }
    for ($cnt = 0; $cnt < $total_rows; $cnt++) {
        if ($modified == $rows[$cnt]['ID']) {
            // Class for modified row.
            $class = 'class="modified_row"';
        } else {
            if ('0' == $rows[$cnt]['type']) {
                // Class for section row.
                $class = 'class="section"';
            } else {
                if (0 == $odd_cnt % 2) {
                    // Class for even row.
                    $class = 'class="even_row"';
                } else {
                    $class = 'class="odd_row"';
                }
            }
        }
        echo "<tr {$class}>\n";
        // Generate table data class.
        $namedisp = _t($rows[$cnt]['namedisp']);
        if ('0' == $rows[$cnt]['type']) {
            if ($modified == $rows[$cnt]['ID']) {
                $class = 'class="modified_row"';
            } else {
                $class = 'class="section"';
            }
            echo "<td colspan=\"3\">{$namedisp}</td>\n";
            $odd_cnt = 0;
        } else {
            if ($modified == $rows[$cnt]['ID']) {
                $class = 'class="modified_row"';
            } else {
                if (0 == $odd_cnt % 2) {
                    $class = 'class="odd_row"';
                } else {
                    $class = '';
                }
            }
            if ($rows[$cnt]['group_mark'] != '') {
                $row_style = 'style="color:#777777"';
            } else {
                $row_style = '';
            }
            $type_name = get_type_name($rows[$cnt]['type']);
            echo "<td width=\"30%\" {$row_style}>{$rows[$cnt]['name']}</td>\n";
            echo "<td width=\"30%\" {$row_style}>{$namedisp}</td>\n";
            echo "<td {$row_style}>{$type_name}</td>\n";
            $odd_cnt++;
        }
        // Generate links.
        // Generate 'Move up' link.
        if (0 == $cnt) {
            // Don't generate any link for the first field.
            echo "<td width=\"15px\"></td>\n";
        } else {
            $move_up = "profile_fields.php?ID={$rows[$cnt]['ID']}&action=move_up";
            echo "<td width=\"15px\"><a href=\"{$move_up}\"><img src=\"images/arrow_up.gif\" alt=\"Move up\" border=\"0\"/></a></td>\n";
        }
        // Generate 'Move down' link.
        if ($cnt == $total_rows - 1) {
            // Don't generate any link for the last field.
            echo "<td width=\"15px\">&nbsp;</td>\n";
        } else {
            $move_down = "profile_fields.php?ID={$rows[$cnt]['ID']}&action=move_down";
            echo "<td width=\"15px\"><a href=\"{$move_down}\"><img src=\"images/arrow_down.gif\" alt=\"Move down\" border=\"0\"/></a></td>\n";
        }
        // Check if field can be deleted.
        if (!in_array($rows[$cnt]['db_name'], $mandatory)) {
            echo "<td width=\"15px\" align=\"center\"><a href=\"profile_fields.php?ID={$rows[$cnt][ID]}&action=delete\"><img src=\"images/delete.gif\" alt=\"Delete\" border=\"0\" title=\"Delete\" /></a></td>\n";
        } else {
            echo "<td width=\"15px\">&nbsp;</td>\n";
        }
        if (false != field_editable($rows[$cnt])) {
            echo "<td width=\"15px\" align=\"center\"><a href=\"profile_fields.php?ID={$rows[$cnt]['ID']}&action=edit\"><img src=\"images/edit.gif\" alt=\"Edit\" border=\"0\" title=\"Edit\" /></a></td>\n";
        } else {
            echo "<td width=\"15px\"></td>\n";
        }
        echo "</tr>\n";
    }
    echo "</table>\n";
}
 public function goods_edit()
 {
     $goods_id = intval($_REQUEST['goods_id']);
     if (IS_POST) {
         $data['gc_id'] = intval($_POST['gc_id']);
         $data['goods_name'] = str_rp(trim($_POST['goods_name']));
         $data['goods_status'] = str_rp(trim($_POST['goods_status']));
         $data['goods_url'] = str_rp(trim($_POST['goods_url']));
         /* $data['goods_price'] = floatval($_POST['goods_price']);
         			$data['goods_o_price'] = floatval($_POST['goods_o_price']);
         			$data['add_bounty'] = floatval($_POST['add_bounty']);
         			$data['freight'] = floatval($_POST['freight']);
         			$data['goods_floor_price'] = floatval($_POST['goods_floor_price']); */
         $data['bargain_limit'] = intval($_POST['bargain_limit']);
         $data['buy_limit'] = intval($_POST['buy_limit']);
         $data['goods_storage'] = intval($_POST['goods_storage']);
         $data['goods_min_num'] = intval($_POST['goods_min_num']);
         $data['entry_mode'] = str_rp(trim($_POST['entry_mode']));
         $data['search_key'] = str_rp(trim($_POST['search_key']));
         $data['search_tip'] = str_rp(trim($_POST['search_tip']));
         $data['comment'] = str_rp(trim($_POST['comment']));
         $data['add_comment'] = str_rp(trim($_POST['add_comment']));
         $data['anonymous'] = intval($_POST['anonymous']);
         $data['has_word'] = intval($_POST['has_word']);
         $data['all_marks'] = intval($_POST['all_marks']);
         $data['is_vip'] = intval($_POST['is_vip']);
         $data['need_talk_seller'] = intval($_POST['need_talk_seller']);
         $data['need_chang_price'] = intval($_POST['need_chang_price']);
         $data['goods_sort'] = intval($_POST['goods_sort']);
         $data['pay_result'] = intval($_POST['pay_result']);
         $res = $this->model->where(array('goods_id' => $goods_id))->save($data);
         if ($res) {
             $this->success('编辑商品成功', U('goods'));
         } else {
             $this->error('编辑商品失败');
         }
     } else {
         /**
          * 父类列表
          */
         $class_list = getTreeClassList(3);
         if (is_array($class_list)) {
             foreach ($class_list as $k => $v) {
                 $class_list[$k]['gc_name'] = str_repeat("&nbsp;", $v['deep'] * 2) . '├ ' . $v['gc_name'];
             }
         }
         $rs = $this->model->relation(true)->where('goods_id=' . $goods_id)->find();
         $this->assign('rs', $rs);
         //规格
         $spec_list = M('GoodsSpec')->where('goods_id=' . $goods_id)->order('spec_goods_sort asc')->select();
         //多图片
         $pic_list = M('GoodsPic')->where('goods_id=' . $goods_id)->order('p_sort asc')->select();
         //常用城市
         $this->city_list = D('District')->where('usetype=1')->order('d_sort desc')->select();
         //相册
         /* $ac_list = M('AlbumClass')->order('aclass_sort asc')->select();
         			$pc_list = M('AlbumPic')->where('aclass_id=1')->order('upload_time asc')->select();
         			$this->assign('ac_list', $ac_list);
         			$this->assign('pc_list', $pc_list); */
         $this->assign('spec_list', $spec_list);
         $this->assign('spec_list_i', count($spec_list) + 1);
         $this->assign('pic_list', $pic_list);
         $this->assign('pic_list_i', count($pic_list) + 1);
         $this->assign('class_list', $class_list);
         $this->assign('title', get_type_name($rs['goods_type_id']) . '任务-编辑');
         $this->display();
     }
 }